-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
055b3a8
commit bb59c47
Showing
16 changed files
with
1,237 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
import React from 'react'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
import { enableFreeze, enableScreens } from 'react-native-screens'; | ||
import { View } from 'react-native'; | ||
import HomeScreen from './src/views/HomeScreen'; | ||
import MockScreen from './src/views/MockConnect'; | ||
import { getHardwareSDKInstance } from './src/utils/hardwareInstance'; | ||
import PassphraseTestScreen from './src/views/PassphraseTestScreen'; | ||
import SDKProvider from './src/provider/SDKProvider'; | ||
|
||
getHardwareSDKInstance(); | ||
|
||
const Stack = createNativeStackNavigator(); | ||
export default function App() { | ||
return ( | ||
<NavigationContainer> | ||
<Stack.Navigator initialRouteName="Home"> | ||
<Stack.Screen name="Home" component={HomeScreen} /> | ||
<Stack.Screen name="Mock" component={MockScreen} /> | ||
</Stack.Navigator> | ||
<SDKProvider> | ||
<Stack.Navigator initialRouteName="Home"> | ||
<Stack.Screen name="Home" component={HomeScreen} /> | ||
<Stack.Screen name="PassphraseTest" component={PassphraseTestScreen} /> | ||
<Stack.Screen name="Mock" component={MockScreen} /> | ||
</Stack.Navigator> | ||
</SDKProvider> | ||
</NavigationContainer> | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
packages/connect-examples/expo-example/src/components/CommonInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useCallback } from 'react'; | ||
import { StyleSheet, Text, TextInput, View } from 'react-native'; | ||
|
||
export type CommonInputProps = { | ||
value: string; | ||
onChange: (value: string) => void; | ||
label: string; | ||
type?: 'number' | 'text'; | ||
}; | ||
export const CommonInput = ({ value, onChange, label, type }: CommonInputProps) => { | ||
const onChangeCallback = useCallback( | ||
(text: string) => { | ||
if (type === 'number') { | ||
onChange(text.replace(/[^\d]+/, '')); | ||
} else { | ||
onChange(text); | ||
} | ||
}, | ||
[onChange, type] | ||
); | ||
|
||
return ( | ||
<View> | ||
<Text style={styles.label}>{label}</Text> | ||
<TextInput | ||
style={styles.input} | ||
keyboardType="numeric" | ||
value={value} | ||
onChangeText={onChangeCallback} | ||
/> | ||
</View> | ||
); | ||
}; | ||
const styles = StyleSheet.create({ | ||
input: { | ||
borderColor: '#E0E0E0', | ||
borderWidth: 1, | ||
borderRadius: 4, | ||
padding: 6, | ||
margin: 2, | ||
fontSize: 16, | ||
}, | ||
label: { | ||
fontWeight: 'bold', | ||
marginBottom: 4, | ||
fontSize: 14, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.