Skip to content

Commit f759476

Browse files
committed
fix: react native lib integration
1 parent a37bf55 commit f759476

File tree

7 files changed

+80
-52
lines changed

7 files changed

+80
-52
lines changed

demo/mobile/reactnative/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import {
1616
useColorScheme,
1717
} from 'react-native';
1818

19+
// Internal
20+
import ReactNativeForm from '../../../src/Form';
21+
1922
const LeftContent = (props: any) => <Avatar.Icon {...props} icon="folder" />
2023

2124
const App = () => {
@@ -51,6 +54,7 @@ const App = () => {
5154
<Button>Ok</Button>
5255
</Card.Actions>
5356
</Card>
57+
<ReactNativeForm />
5458
</SafeAreaView>
5559
</PaperProvider>
5660
);

demo/mobile/reactnative/ios/Podfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ PODS:
333333
- React-cxxreact (= 0.65.1)
334334
- React-jsi (= 0.65.1)
335335
- React-perflogger (= 0.65.1)
336+
- RNVectorIcons (8.1.0):
337+
- React-Core
336338
- Yoga (1.14.0)
337339
- YogaKit (1.18.1):
338340
- Yoga (~> 1.14)
@@ -388,6 +390,7 @@ DEPENDENCIES:
388390
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
389391
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
390392
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
393+
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
391394
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
392395

393396
SPEC REPOS:
@@ -463,6 +466,8 @@ EXTERNAL SOURCES:
463466
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
464467
ReactCommon:
465468
:path: "../node_modules/react-native/ReactCommon"
469+
RNVectorIcons:
470+
:path: "../node_modules/react-native-vector-icons"
466471
Yoga:
467472
:path: "../node_modules/react-native/ReactCommon/yoga"
468473

@@ -508,6 +513,7 @@ SPEC CHECKSUMS:
508513
React-RCTVibration: 92d41c2442e5328cc4d342cd7f78e5876b68bae5
509514
React-runtimeexecutor: 85187f19dd9c47a7c102f9994f9d14e4dc2110de
510515
ReactCommon: eafed38eec7b591c31751bfa7494801618460459
516+
RNVectorIcons: 31cebfcf94e8cf8686eb5303ae0357da64d7a5a4
511517
Yoga: aa0cb45287ebe1004c02a13f279c55a95f1572f4
512518
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
513519

demo/mobile/reactnative/ios/reactnative.xcodeproj/project.pbxproj

Lines changed: 17 additions & 51 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

demo/mobile/reactnative/metro.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
* @format
66
*/
77

8+
const path = require('path');
9+
10+
const extraNodeModules = {
11+
'../../../src': path.resolve(__dirname + '/../../../src'),
12+
};
13+
14+
const watchFolders = [
15+
path.resolve(__dirname + '/../../../src')
16+
];
17+
818
module.exports = {
919
transformer: {
1020
getTransformOptions: async () => ({
@@ -14,4 +24,12 @@ module.exports = {
1424
},
1525
}),
1626
},
27+
resolver: {
28+
extraNodeModules: new Proxy(extraNodeModules, {
29+
get: (target, name) =>
30+
//redirects dependencies referenced from common/ to local node_modules
31+
name in target ? target[name] : path.join(process.cwd(), `node_modules/${name}`),
32+
}),
33+
},
34+
watchFolders,
1735
};

demo/mobile/reactnative/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Form.native.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Library
2+
import React from 'react';
3+
import { View, Text } from 'react-native';
4+
import { RadioButton } from 'react-native-paper';
5+
6+
const ReactNativeForm = () => {
7+
const [checked, setChecked] = React.useState('first');
8+
9+
return (
10+
<View>
11+
<Text> I was here </Text>
12+
<RadioButton
13+
value="first"
14+
status={ checked === 'first' ? 'checked' : 'unchecked' }
15+
onPress={() => setChecked('first')}
16+
/>
17+
<RadioButton
18+
value="second"
19+
status={ checked === 'second' ? 'checked' : 'unchecked' }
20+
onPress={() => setChecked('second')}
21+
/>
22+
</View>
23+
);
24+
};
25+
26+
export default ReactNativeForm;

0 commit comments

Comments
 (0)