Skip to content

Upgrade React Native to 0.72.3 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.onedevice/storybook.requires.js
73 changes: 72 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,75 @@
module.exports = {
root: true,
extends: '@react-native-community',
extends: '@react-native',
plugins: ['import'],
rules: {
// this is for sorting WITHIN an import
'sort-imports': ['error', {ignoreCase: true, ignoreDeclarationSort: true}],
// this is for sorting imports
'import/order': [
'error',
{
groups: [
['external', 'builtin'],
'internal',
['sibling', 'parent'],
'index',
],
pathGroups: [
{
pattern: '@(react|react-native)',
group: 'external',
position: 'before',
},
{
pattern: '@components/**',
group: 'internal',
},
{
pattern: '@assets/**',
group: 'internal',
},
{
pattern: '@contexts/**',
group: 'internal',
},
{
pattern: '@styles/**',
group: 'internal',
},
{
pattern: '@hooks/**',
group: 'internal',
},
{
pattern: '@modules/**',
group: 'internal',
},
{
pattern: '@navigators/**',
group: 'internal',
},
{
pattern: '@screens/**',
group: 'internal',
},
{
pattern: '@app-types/**',
group: 'internal',
},
{
pattern: '@utils/**',
group: 'internal',
},
],
pathGroupsExcludedImportTypes: ['internal', 'react'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'prettier/prettier': ['error', {endOfLine: 'auto'}],
},
};
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ buck-out/
# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/

# testing
/coverage

#storybook
storybook-static
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged
1 change: 0 additions & 1 deletion .node-version

This file was deleted.

3 changes: 1 addition & 2 deletions .ondevice/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module.exports = {
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
stories: ['../src/components/**/*.stories.?(ts|tsx|js|jsx)'],
addons: [
'@storybook/addon-ondevice-notes',
'@storybook/addon-ondevice-controls',
'@storybook/addon-ondevice-backgrounds',
'@storybook/addon-ondevice-actions',
],
};
7 changes: 2 additions & 5 deletions .ondevice/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {withBackgrounds} from '@storybook/addon-ondevice-backgrounds';

export const decorators = [withBackgrounds];

export const parameters = {
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
Expand All @@ -8,9 +10,4 @@ export const parameters = {
date: /Date$/,
},
},
backgrounds: [
{name: 'plain', value: 'white', default: true},
{name: 'warm', value: 'hotpink'},
{name: 'cool', value: 'deepskyblue'},
],
};
33 changes: 13 additions & 20 deletions .ondevice/storybook.requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,43 @@ import {
addParameters,
addArgsEnhancer,
clearDecorators,
} from "@storybook/react-native";
} from '@storybook/react-native';

global.STORIES = [
{
titlePrefix: "",
directory: "./components",
files: "**/*.stories.?(ts|tsx|js|jsx)",
titlePrefix: '',
directory: './src/components',
files: '**/*.stories.?(ts|tsx|js|jsx)',
importPathMatcher:
"^\\.[\\\\/](?:components(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(?:ts|tsx|js|jsx)?)$",
'^\\.[\\\\/](?:src[\\\\/]components(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(?:ts|tsx|js|jsx)?)$',
},
];

import "@storybook/addon-ondevice-notes/register";
import "@storybook/addon-ondevice-controls/register";
import "@storybook/addon-ondevice-backgrounds/register";
import "@storybook/addon-ondevice-actions/register";
import '@storybook/addon-ondevice-notes/register';
import '@storybook/addon-ondevice-controls/register';
import '@storybook/addon-ondevice-backgrounds/register';

import { argsEnhancers } from "@storybook/addon-actions/dist/modern/preset/addArgs";

import { decorators, parameters } from "./preview";
import {decorators, parameters} from './preview';

if (decorators) {
if (__DEV__) {
// stops the warning from showing on every HMR
require("react-native").LogBox.ignoreLogs([
"`clearDecorators` is deprecated and will be removed in Storybook 7.0",
require('react-native').LogBox.ignoreLogs([
'`clearDecorators` is deprecated and will be removed in Storybook 7.0',
]);
}
// workaround for global decorators getting infinitely applied on HMR, see https://github.com/storybookjs/react-native/issues/185
clearDecorators();
decorators.forEach((decorator) => addDecorator(decorator));
decorators.forEach(decorator => addDecorator(decorator));
}

if (parameters) {
addParameters(parameters);
}

try {
argsEnhancers.forEach((enhancer) => addArgsEnhancer(enhancer));
} catch {}

const getStories = () => {
return {
"./components/Button/Button.stories.tsx": require("../components/Button/Button.stories.tsx"),
'./src/components/Button/Button.stories.tsx': require('../src/components/Button/Button.stories.tsx'),
};
};

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.onedevice/storybook.requires.js
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

24 changes: 23 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const path = require('path');

module.exports = {
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
stories: ['../src/components/**/*.stories.?(ts|tsx|js|jsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
Expand All @@ -9,4 +11,24 @@ module.exports = {
core: {
builder: 'webpack5',
},
webpackFinal: async config => {
config.module?.rules?.push({
test: /\.css$/,
use: [
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [require('tailwindcss'), require('autoprefixer')],
},
},
},
],
include: path.resolve(__dirname, '../'),
});

return {
...config,
};
},
};
6 changes: 4 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import '../src/styles/index.css';

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
actions: {argTypesRegex: '^on[A-Z].*'},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
};
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
},
"editor.formatOnSave": false,
}
26 changes: 8 additions & 18 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import React from 'react';
import {View, Text, SafeAreaView, StyleSheet} from 'react-native';
import {SafeAreaView, Text, View} from 'react-native';

import {SafeAreaProvider} from 'react-native-safe-area-context';
import {MyButton} from './components/Button/Button';

import Button from '@components/Button/button';

export default () => (
<SafeAreaProvider>
<SafeAreaView style={styles.safeArea}>
<View style={styles.container}>
<Text>Application</Text>
<MyButton text="Hello world!" color="purple" onPress={() => {}} />
<SafeAreaView>
<View>
<Text className="text-primary">Application</Text>
<Button label="test" />
</View>
</SafeAreaView>
</SafeAreaProvider>
);

const styles = StyleSheet.create({
safeArea: {
flex: 1,
},
container: {
flex: 1,
paddingTop: 16,
gap: 16,
alignItems: 'center',
},
});
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby File.read(File.join(__dir__, '.ruby-version')).strip
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.11', '>= 1.11.3'
gem 'cocoapods', '~> 1.12'
14 changes: 0 additions & 14 deletions __tests__/App-test.tsx

This file was deleted.

11 changes: 11 additions & 0 deletions __tests__/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable import/order */
/* eslint-disable @typescript-eslint/no-unused-vars */
import React from 'react';

// Note: import explicitly to use the types shiped with jest.
import {it} from '@jest/globals';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

import App from '../App';
Loading