diff --git a/.github/workflows/discussion-to-slack.yml b/.github/workflows/discussion-to-slack.yml index c175487107..8b13789179 100644 --- a/.github/workflows/discussion-to-slack.yml +++ b/.github/workflows/discussion-to-slack.yml @@ -1,40 +1 @@ -name: Discussion to Slack Notification -on: - discussion: - types: [created] - -jobs: - notify-slack: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Get discussion details - id: discussion-details - run: | - echo "title=${{ github.event.discussion.title }}" >> $GITHUB_OUTPUT - echo "body=${{ github.event.discussion.body }}" >> $GITHUB_OUTPUT - echo "url=${{ github.event.discussion.html_url }}" >> $GITHUB_OUTPUT - echo "author=${{ github.event.discussion.user.login }}" >> $GITHUB_OUTPUT - echo "category=${{ github.event.discussion.category.name }}" >> $GITHUB_OUTPUT - - - name: Post to Slack channel - id: slack - uses: slackapi/slack-github-action@v1.23.0 - with: - channel-id: ${{ secrets.SLACK_CHANNEL_ID }} - slack-message: | - :speech_balloon: New Discussion Created :speech_balloon: - *Title:* ${{ steps.discussion-details.outputs.title }} - *Author:* ${{ steps.discussion-details.outputs.author }} - *Category:* ${{ steps.discussion-details.outputs.category }} - *Link:* ${{ steps.discussion-details.outputs.url }} - - *Discussion Body:* - ``` - ${{ steps.discussion-details.outputs.body }} - ``` - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} diff --git a/.github/workflows/expo-latest-nightly.yml b/.github/workflows/expo-latest-nightly.yml new file mode 100644 index 0000000000..183b777fcf --- /dev/null +++ b/.github/workflows/expo-latest-nightly.yml @@ -0,0 +1,71 @@ +name: Expo Latest Nightly + +on: + push: + branches: [ feat/v3 ] + pull_request: + branches: [ feat/v3 ] + schedule: + - cron: '0 0 * * *' # Run daily at midnight UTC + +jobs: + check-expo-version: + runs-on: macos-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + latest_version: ${{ steps.check.outputs.latest_version }} + steps: + - id: check + run: | + LATEST=$(npm view expo version) + CURRENT=$(cat .expo-version 2>/dev/null || echo "") + if [ "$LATEST" != "$CURRENT" ]; then + echo "should_run=true" >> $GITHUB_OUTPUT + echo "latest_version=$LATEST" >> $GITHUB_OUTPUT + echo $LATEST > .expo-version + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi + test-expo-latest: + needs: check-expo-version + if: ${{ needs.check-expo-version.outputs.should_run == 'true' || github.event_name == 'push' || github.event_name == 'pull_request' }} + runs-on: macos-latest + name: Expo latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Create Expo project + run: | + npx create-expo-app@latest test-app + cd test-app + - name: Install dependencies + working-directory: test-app + run: | + npm install react-native-web react-dom @expo/metro-runtime + - name: Install gluestack-ui + working-directory: test-app + run: | + npx gluestack-ui-nightly init --template-only --projectType expo + npx gluestack-ui-nightly add --all + npx tailwindcss -i ./global.css -o ./node_modules/.cache/nativewind/global.css + - name: Start Expo web app + working-directory: test-app + run: | + npm run web & sleep 30 + notify: + needs: test-expo-latest + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/feat/v3' + runs-on: macos-latest + steps: + - name: Slack Notification + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + text: 'Expo Latest Test: ${{ job.status }}' + fields: repo,commit,action,eventName + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/next-latest-nightly.yml b/.github/workflows/next-latest-nightly.yml new file mode 100644 index 0000000000..78369d8abf --- /dev/null +++ b/.github/workflows/next-latest-nightly.yml @@ -0,0 +1,98 @@ +name: Next.js Latest Nightly + +on: + push: + branches: [feat/v3] + pull_request: + branches: [feat/v3] + schedule: + - cron: '0 0 * * *' # Run daily at midnight UTC + +jobs: + check-next-version: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + latest_version: ${{ steps.check.outputs.latest_version }} + steps: + - id: check + run: | + LATEST=$(npm view next version) + CURRENT=$(cat .next-version 2>/dev/null || echo "") + echo "Latest version: $LATEST" + echo "Current version: $CURRENT" + if [ "$LATEST" != "$CURRENT" ]; then + echo "should_run=true" >> $GITHUB_OUTPUT + echo "latest_version=$LATEST" >> $GITHUB_OUTPUT + echo $LATEST > .next-version + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi + + test-next-latest: + needs: check-next-version + if: ${{ needs.check-next-version.outputs.should_run == 'true' || github.event_name == 'push' || github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + name: Next.js latest + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Print Environment Info + run: | + node -v + npm -v + cat .next-version || echo ".next-version file not found" + + - name: Set Git identity + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Create Next.js project from create-command + run: | + npx create-gluestack-nightly@latest test-app --starter-kit-next + cd test-app + + - name: Build Next.js app + working-directory: test-app + env: + NEXT_TELEMETRY_DISABLED: 1 + run: | + npm run build + + - name: Start Next.js app + working-directory: test-app + run: | + npm run start & + sleep 20 + + - name: Fetch and Log Server Response + run: | + curl -s http://localhost:3000 || echo "Failed to reach the server" + curl -s http://localhost:3000 > server_response.html + cat server_response.html + + - name: Check if text is rendered + run: | + RESPONSE=$(curl -s http://localhost:3000) + echo "$RESPONSE" | grep -q "Get started by editing" && echo "text found" || (echo "text not found" && exit 1) + + notify: + needs: test-next-latest + if: always() && github.event_name == 'push' && github.ref == 'refs/heads/feat/v3' + runs-on: ubuntu-latest + steps: + - name: Slack Notification + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + text: 'Next.js Latest Test: ${{ job.status }}' + fields: repo,commit,action,eventName + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/vercel-deployments.yml b/.github/workflows/vercel-deployments.yml new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/.github/workflows/vercel-deployments.yml @@ -0,0 +1 @@ + diff --git a/example/storybook-nativewind/src/core-components/nativewind/grid/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/grid/index.tsx index 3270278f03..64bc8c400d 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/grid/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/grid/index.tsx @@ -251,10 +251,6 @@ type IGridItemProps = ViewProps & const GridItem = forwardRef, IGridItemProps>( function GridItem({ className, _extra, ...props }, ref) { - const [flexBasisValue, setFlexBasisValue] = useState< - number | string | null - >('auto'); - const { calculatedWidth, numColumns, @@ -269,7 +265,7 @@ const GridItem = forwardRef, IGridItemProps>( generateResponsiveColSpans({ gridItemClassName: gridItemClass }) ) ?? 1) as number; - useEffect(() => { + const flexBasisValue = useMemo(() => { if ( !flexDirection?.includes('column') && calculatedWidth && @@ -291,18 +287,17 @@ const GridItem = forwardRef, IGridItemProps>( ? 2 : rowColsCount - 1); - const flexBasisVal = + return ( Math.min( (((calculatedWidth - gutterOffset) * responsiveColSpan) / numColumns / calculatedWidth) * - 100, - 100 - ) + '%'; - - setFlexBasisValue(flexBasisVal); + 100, + 100, + ) + '%' + ); } - // eslint-disable-next-line react-hooks/exhaustive-deps + return 'auto'; }, [ calculatedWidth, responsiveColSpan, @@ -310,6 +305,8 @@ const GridItem = forwardRef, IGridItemProps>( columnGap, gap, flexDirection, + itemsPerRow, + props?.index, ]); return ( diff --git a/packages/nativewind/utils/tva/index.ts b/packages/nativewind/utils/tva/index.ts index b2a988fa37..96b341e085 100644 --- a/packages/nativewind/utils/tva/index.ts +++ b/packages/nativewind/utils/tva/index.ts @@ -1,5 +1,5 @@ import type { TVA } from '../types'; -import type { TVConfig } from 'tailwind-variants/dist/config'; +import type { TVConfig } from 'tailwind-variants/dist/config.d.ts'; import { deepMergeObjects } from '../utils/deepMerge'; // @ts-ignore import { tv } from 'tailwind-variants';