Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
rules: {'prettier/prettier': ['error', {endOfLine: 'auto'}]},
};
128 changes: 77 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,119 +6,145 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16]
node-version: [16]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
version: 8.6.9
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "::set-output name=dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: yarn
run: pnpm install
- name: ESLint Checks
run: yarn lint
run: pnpm lint
flow:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16]
node-version: [16]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
version: 8.6.9
- name: Get pnpm cache
id: pnpm-cache
run: echo "::set-output name=dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: yarn
run: pnpm install
- name: Flow Checks
run: yarn flow check
run: pnpm flow check
tsc:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16]
node-version: [16]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
version: 8.6.9
- name: Get pnpm cache
id: pnpm-cache
run: echo "::set-output name=dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: yarn
run: pnpm install
- name: TypeScript type check
run: yarn tsc
run: pnpm tsc
android:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16]
node-version: [16]
java-version: [11]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v2
with:
version: 8.6.9
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
- name: Get pnpm cache
id: pnpm-cache
run: echo "::set-output name=dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: yarn
- name: Install Example Dependencies
run: cd example && yarn
run: pnpm install
- name: Build android
run: cd example && yarn build:android
run: cd example && pnpm build:android
- name: Build Android Example App and Library
run: cd example/android && ./gradlew clean assembleDebug
ios:
runs-on: macos-latest
strategy:
matrix:
node-version: [14, 16]
node-version: [16]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
version: 8.6.9
- name: Get pnpm cache
id: pnpm-cache
run: echo "::set-output name=dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: yarn
- name: Install Example
run: cd example && yarn
run: pnpm install
- name: Build ios
run: cd example && yarn build:ios
run: cd example && pnpm build:ios
- name: Pod install
run: cd example && pod install --project-directory=ios
- name: Run ios app
run: cd example && yarn ios
24 changes: 16 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
version: 8.6.9
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "::set-output name=dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: yarn
run: pnpm
- name: Publish Package
run: yarn ci:publish
run: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node-linker=hoisted
shamefully-hoist=true
auto-install-peers=true
17 changes: 8 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ All work on React Native SegmentedControl happens directly on GitHub. Contributo
> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).

1. Fork the repo and create your branch from `master` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)).
2. Run `yarn` or `npm install` to install all required dependencies.
2. Run `pnpm install` to install all required dependencies.
3. Now you are ready to make your changes!

## Tests & Verifications

Currently we use `flow` for typechecking, `eslint` with `prettier` for linting and formatting the code, and `jest` for unit testing. We also use `detox` for end-to-end testing. All of these are run on Github Actions for all opened pull requests, but you should use them locally when making changes.

- `yarn test`: Run all tests and validations.
- `yarn lint`: Run `eslint`.
- `yarn lint --fix`: Run `eslint` and automatically fix issues. This is useful for correcting code formatting.
- `yarn flow`: Run `flow` typechecking.
<!-- * `yarn validate:typescript`: Run `typescript` typechecking. -->
<!-- * `yarn test:jest`: Run unit tests with `jest`. -->
<!-- * `yarn test:detox:<android|ios>:build:<debug|release>`: Build the `debug` or `release` app for end-to-end tests with `detox` on either `android` or `ios`. You need to run this before running the test command and whenever you make changes to the native code. -->
<!-- * `yarn test:detox:<android|ios>:test:<debug|release>`: Run the `debug` or `release` end-to-end tests with `detox` on either `android` or `ios`. -->
- `pnpm test`: Run all tests and validations.
- `pnpm lint`: Run `eslint`.
- `pnpm lint --fix`: Run `eslint` and automatically fix issues. This is useful for correcting code formatting.
- `pnpm flow`: Run `flow` typechecking.
<!-- * `pnpm test:jest`: Run unit tests with `jest`. -->
<!-- * `pnpm test:detox:<android|ios>:build:<debug|release>`: Build the `debug` or `release` app for end-to-end tests with `detox` on either `android` or `ios`. You need to run this before running the test command and whenever you make changes to the native code. -->
<!-- * `pnpm test:detox:<android|ios>:test:<debug|release>`: Run the `debug` or `release` end-to-end tests with `detox` on either `android` or `ios`. -->

## Sending a pull request

Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ This module is NOT supported in the Expo Go app on iOS, because it requires cust

## Getting started

Install the library using either Yarn:
Install the library using your package manager:

pnpm:

```
pnpm install --save @react-native-segmented-control/segmented-control
```


yarn:

```
yarn add @react-native-segmented-control/segmented-control
```

or npm:
npm:

```
npm install --save @react-native-segmented-control/segmented-control
Expand Down
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
2 changes: 1 addition & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @flow
*/

import SegmentedControl from '@react-native-segmented-control/segmented-control';
import SegmentedControl from '..';
import React, {useEffect, useState} from 'react';
import {ScrollView, StyleSheet, Text, View, useColorScheme} from 'react-native';

Expand Down
1 change: 1 addition & 0 deletions example/ios/.xcode.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export NODE_BINARY=/Users/naturalclar/.volta/tools/image/node/18.15.0/bin/node
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../node_modules/react-native-test-app/test_app'
require_relative '../../node_modules/react-native-test-app/test_app'

use_flipper!({ 'Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3' })

Expand Down
Loading