Skip to content
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

Upgrade to React Native 0.72.17 #267

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 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 .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
commitlint --edit $1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the new .husky/pre-commit files do the same thing that this used to:

"husky": {
    "hooks": {
      "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
      "pre-commit": "yarn lint && yarn typescript"
    }
  },

2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn lint
yarn typescript
17 changes: 17 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,22 @@ target 'RiveReactNativeExample' do
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)

# This is a temporary workaround for the issue described here:
# https://github.com/facebook/react-native/issues/43335. Flipper is no longer
# used in React Native 0.74 so this workaround can be removed once we upgrade.
installer.pods_project.targets.each do |target|
if target.name == 'Flipper'
file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
contents = File.read(file_path)
unless contents.include?('#include <functional>')
File.chmod(0755, file_path)
File.open(file_path, 'w') do |file|
file.puts('#include <functional>')
file.puts(contents)
end
end
end
end
end
end
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ PODS:
- React-jsi (= 0.72.7)
- React-logger (= 0.72.7)
- React-perflogger (= 0.72.7)
- rive-react-native (7.2.0):
- rive-react-native (7.3.0):
- React-Core
- RiveRuntime (= 5.14.0)
- RiveRuntime (5.14.0)
Expand Down Expand Up @@ -744,7 +744,7 @@ SPEC CHECKSUMS:
React-runtimescheduler: 7649c3b46c8dee1853691ecf60146a16ae59253c
React-utils: 56838edeaaf651220d1e53cd0b8934fb8ce68415
ReactCommon: 5f704096ccf7733b390f59043b6fa9cc180ee4f6
rive-react-native: c5f46a81d999be348e3a4875f5d5a42b0288db78
rive-react-native: 9d724daa93efa3066e19e53960f83df5098cc112
RiveRuntime: c470cc8daa0c192c678f7abb35b980f95d2bb625
RNCMaskedView: 949696f25ec596bfc697fc88e6f95cf0c79669b6
RNCPicker: 0991c56da7815c0cf946d6f63cf920b25296e5f6
Expand All @@ -755,6 +755,6 @@ SPEC CHECKSUMS:
Yoga: 4c3aa327e4a6a23eeacd71f61c81df1bcdf677d5
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 2e1de35b032a6e591da83a5975df1059c489c1d8
PODFILE CHECKSUM: 9b8157b65995a3b93867bae57fe6135829ff2530

COCOAPODS: 1.15.2
12 changes: 10 additions & 2 deletions example/ios/RiveReactNativeExample.xcodeproj/project.pbxproj
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file happen automatically when running yarn bootstrap.

Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,11 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
};
Expand Down Expand Up @@ -972,7 +976,11 @@
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = "$(inherited)";
OTHER_LDFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand Down
2 changes: 1 addition & 1 deletion example/src/LoopMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Button, RadioButton } from 'react-native-paper';
import { isEnum } from './typesPredicates';

const BUTTONS = ['stop', 'pause', 'play'] as const;
type ButtonKeys = typeof BUTTONS[number];
type ButtonKeys = (typeof BUTTONS)[number];

export default function LoopModeComponent() {
const riveRef = React.useRef<RiveRef>(null);
Expand Down
2 changes: 1 addition & 1 deletion example/src/SimpleControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Button, Text } from 'react-native-paper';
const resourceName = 'truck_v7';

const BUTTONS = ['stop', 'play', 'pause'] as const;
type ButtonsKey = typeof BUTTONS[number];
type ButtonsKey = (typeof BUTTONS)[number];

export default function SimpleControls() {
const [activeButton, setActiveButton] = useState<ButtonsKey>('stop');
Expand Down
43 changes: 19 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,28 @@
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {
"@commitlint/config-conventional": "^11.0.0",
"@react-native-community/eslint-config": "^2.0.0",
"@react-native/metro-config": "^0.72.11",
"@release-it/conventional-changelog": "^2.0.0",
"@commitlint/config-conventional": "^19.5.0",
"@react-native-community/eslint-config": "^3.2.0",
"@react-native/metro-config": "^0.72.12",
"@release-it/conventional-changelog": "^7.0.2",
"@tsconfig/react-native": "^3.0.0",
"@types/jest": "^26.0.0",
"@types/jest": "^29.5.13",
"@types/react": "^18.0.24",
"@types/react-native": "0.72.2",
"commitlint": "^11.0.0",
"eslint": "^7.2.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.2.5",
"jest": "^26.0.1",
"pod-install": "^0.1.0",
"prettier": "^2.0.5",
"@types/react-native": "0.73.0",
"commitlint": "^19.5.0",
"eslint": "^8.19.8",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"husky": "^9.1.6",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "^0.77.0",
"pod-install": "^0.2.2",
"prettier": "^3.3.3",
"react": "18.2.0",
"react-native": "0.72.7",
"react-native-builder-bob": "^0.18.0",
"react-native-codegen": " 0.0.7",
"release-it": "^14.2.2",
"react-native": "0.72.17",
"react-native-builder-bob": "^0.30.2",
"react-native-codegen": "^0.70.7",
"release-it": "^16.2.1",
"typescript": "^4.8.4"
},
"peerDependencies": {
Expand All @@ -77,12 +78,6 @@
"engines": {
"node": ">=16"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "yarn lint && yarn typescript"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
Expand Down
1 change: 0 additions & 1 deletion src/Rive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@

const play = useCallback<RiveRef[ViewManagerMethod.play]>(
(
// eslint-disable-next-line no-shadow
animationName = '',

Check warning on line 236 in src/Rive.tsx

View workflow job for this annotation

GitHub Actions / typecheck-and-lint

'animationName' is already declared in the upper scope on line 131 column 7
loop = LoopMode.Auto,
direction = Direction.Auto,
isStateMachine = false
Expand Down
28 changes: 28 additions & 0 deletions src/__tests__/helpers.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { isEnum } from '../helpers';

describe('isEnum function', () => {
enum TestEnum {
ValueA = 'A',
ValueB = 'B',
ValueC = 'C',
}

it('should return true for a valid enum value', () => {
expect(isEnum(TestEnum, 'A')).toBe(true);
expect(isEnum(TestEnum, 'B')).toBe(true);
expect(isEnum(TestEnum, 'C')).toBe(true);
});

it('should return false for an invalid enum value', () => {
expect(isEnum(TestEnum, 'D')).toBe(false);
expect(isEnum(TestEnum, 'E')).toBe(false);
expect(isEnum(TestEnum, '')).toBe(false);
expect(isEnum(TestEnum, 'ValueB')).toBe(false);
});

it('should handle non-string inputs gracefully', () => {
expect(isEnum(TestEnum, null as any)).toBe(false);
expect(isEnum(TestEnum, undefined as any)).toBe(false);
expect(isEnum(TestEnum, 123 as any)).toBe(false);
});
});
1 change: 0 additions & 1 deletion src/__tests__/index.test.tsx

This file was deleted.

1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"importsNotUsedAsValues": "error",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated in the next version of typescript.

"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["esnext"],
Expand Down
Loading
Loading