@rownd/react-native 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -6
- package/lib/commonjs/assets/images/error-icon-material.svg +1 -0
- package/lib/commonjs/components/AutoSigninDialog.js +21 -14
- package/lib/commonjs/components/AutoSigninDialog.js.map +1 -1
- package/lib/commonjs/components/BottomSheetTextInput/BottomSheetTextInput.js +65 -0
- package/lib/commonjs/components/BottomSheetTextInput/BottomSheetTextInput.js.map +1 -0
- package/lib/commonjs/components/BottomSheetTextInput/index.js +16 -0
- package/lib/commonjs/components/BottomSheetTextInput/index.js.map +1 -0
- package/lib/commonjs/components/BottomSheetTextInput/types.js +6 -0
- package/lib/commonjs/components/BottomSheetTextInput/types.js.map +1 -0
- package/lib/commonjs/components/DarkText.js +5 -1
- package/lib/commonjs/components/DarkText.js.map +1 -1
- package/lib/commonjs/components/RowndComponents.js +4 -6
- package/lib/commonjs/components/RowndComponents.js.map +1 -1
- package/lib/commonjs/components/SignIn.js +53 -51
- package/lib/commonjs/components/SignIn.js.map +1 -1
- package/lib/commonjs/components/images/ErrorIcon.js +31 -0
- package/lib/commonjs/components/images/ErrorIcon.js.map +1 -0
- package/lib/module/assets/images/error-icon-material.svg +1 -0
- package/lib/module/components/AutoSigninDialog.js +17 -13
- package/lib/module/components/AutoSigninDialog.js.map +1 -1
- package/lib/module/components/BottomSheetTextInput/BottomSheetTextInput.js +52 -0
- package/lib/module/components/BottomSheetTextInput/BottomSheetTextInput.js.map +1 -0
- package/lib/module/components/BottomSheetTextInput/index.js +3 -0
- package/lib/module/components/BottomSheetTextInput/index.js.map +1 -0
- package/lib/module/components/BottomSheetTextInput/types.js +2 -0
- package/lib/module/components/BottomSheetTextInput/types.js.map +1 -0
- package/lib/module/components/DarkText.js +5 -1
- package/lib/module/components/DarkText.js.map +1 -1
- package/lib/module/components/RowndComponents.js +5 -5
- package/lib/module/components/RowndComponents.js.map +1 -1
- package/lib/module/components/SignIn.js +39 -37
- package/lib/module/components/SignIn.js.map +1 -1
- package/lib/module/components/images/ErrorIcon.js +18 -0
- package/lib/module/components/images/ErrorIcon.js.map +1 -0
- package/lib/package.json +4 -6
- package/lib/typescript/src/components/BottomSheetTextInput/BottomSheetTextInput.d.ts +4 -0
- package/lib/typescript/src/components/BottomSheetTextInput/index.d.ts +2 -0
- package/lib/typescript/src/components/BottomSheetTextInput/types.d.ts +3 -0
- package/lib/typescript/src/components/images/ErrorIcon.d.ts +4 -0
- package/package.json +4 -6
- package/src/assets/images/error-icon-material.svg +1 -0
- package/src/components/AutoSigninDialog.tsx +16 -10
- package/src/components/BottomSheetTextInput/BottomSheetTextInput.tsx +57 -0
- package/src/components/BottomSheetTextInput/index.ts +5 -0
- package/src/components/BottomSheetTextInput/types.ts +3 -0
- package/src/components/DarkText.tsx +3 -1
- package/src/components/RowndComponents.tsx +3 -3
- package/src/components/SignIn.tsx +46 -36
- package/src/components/images/ErrorIcon.tsx +11 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { memo, useCallback, forwardRef } from 'react';
|
|
2
|
+
import { TextInput } from 'react-native-gesture-handler';
|
|
3
|
+
import type { BottomSheetTextInputProps } from './types';
|
|
4
|
+
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
const {
|
|
7
|
+
useBottomSheetInternal,
|
|
8
|
+
} = require('@gorhom/bottom-sheet/src/hooks/useBottomSheetInternal');
|
|
9
|
+
|
|
10
|
+
const BottomSheetTextInputComponent = forwardRef<
|
|
11
|
+
TextInput,
|
|
12
|
+
BottomSheetTextInputProps
|
|
13
|
+
>(({ onFocus, onBlur, ...rest }, ref) => {
|
|
14
|
+
//#region hooks
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
let { shouldHandleKeyboardEvents } = useBottomSheetInternal();
|
|
17
|
+
//#endregion
|
|
18
|
+
|
|
19
|
+
if (!shouldHandleKeyboardEvents) {
|
|
20
|
+
shouldHandleKeyboardEvents = {};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#region callbacks
|
|
24
|
+
const handleOnFocus = useCallback(
|
|
25
|
+
(args) => {
|
|
26
|
+
shouldHandleKeyboardEvents.value = true;
|
|
27
|
+
if (onFocus) {
|
|
28
|
+
onFocus(args);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
[onFocus, shouldHandleKeyboardEvents]
|
|
32
|
+
);
|
|
33
|
+
const handleOnBlur = useCallback(
|
|
34
|
+
(args) => {
|
|
35
|
+
shouldHandleKeyboardEvents.value = false;
|
|
36
|
+
if (onBlur) {
|
|
37
|
+
onBlur(args);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[onBlur, shouldHandleKeyboardEvents]
|
|
41
|
+
);
|
|
42
|
+
//#endregion
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<TextInput
|
|
46
|
+
ref={ref}
|
|
47
|
+
onFocus={handleOnFocus}
|
|
48
|
+
onBlur={handleOnBlur}
|
|
49
|
+
{...rest}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const BottomSheetTextInput = memo(BottomSheetTextInputComponent);
|
|
55
|
+
BottomSheetTextInput.displayName = 'BottomSheetTextInput';
|
|
56
|
+
|
|
57
|
+
export default BottomSheetTextInput;
|
|
@@ -3,7 +3,9 @@ import { Text, TextProps, TextStyle } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
export default function DarkText({ style, children, ...rest }: TextProps) {
|
|
5
5
|
if (style) {
|
|
6
|
-
(style as TextStyle).color = '#
|
|
6
|
+
(style as TextStyle).color = '#000000';
|
|
7
|
+
} else {
|
|
8
|
+
style = { color: '#000000' };
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
return (
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { useDeviceContext } from 'twrnc';
|
|
2
|
+
// import { useDeviceContext } from 'twrnc';
|
|
3
3
|
|
|
4
|
-
import tw from '../utils/tailwind';
|
|
4
|
+
// import tw from '../utils/tailwind';
|
|
5
5
|
import { SignIn } from './SignIn';
|
|
6
6
|
import { AutoSigninDialog } from './AutoSigninDialog';
|
|
7
7
|
import { useGlobalContext } from './GlobalContext';
|
|
8
8
|
|
|
9
9
|
export function RowndComponents() {
|
|
10
10
|
const { state } = useGlobalContext();
|
|
11
|
-
useDeviceContext(tw);
|
|
11
|
+
// useDeviceContext(tw);
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<>
|
|
@@ -10,12 +10,13 @@ import { differenceInMinutes } from 'date-fns';
|
|
|
10
10
|
import {
|
|
11
11
|
View,
|
|
12
12
|
StyleSheet,
|
|
13
|
-
|
|
13
|
+
TouchableOpacity,
|
|
14
14
|
Image,
|
|
15
15
|
ActivityIndicator,
|
|
16
16
|
Linking,
|
|
17
|
+
Text,
|
|
17
18
|
} from 'react-native';
|
|
18
|
-
import Text from './DarkText';
|
|
19
|
+
// import Text from './DarkText';
|
|
19
20
|
import { SvgCssUri } from 'react-native-svg';
|
|
20
21
|
import tw from '../utils/tailwind';
|
|
21
22
|
import phone, { type PhoneResult } from 'phone';
|
|
@@ -24,8 +25,9 @@ import {
|
|
|
24
25
|
BottomSheetBackdrop,
|
|
25
26
|
BottomSheetBackdropProps,
|
|
26
27
|
BottomSheetModal,
|
|
27
|
-
BottomSheetTextInput,
|
|
28
28
|
} from '@gorhom/bottom-sheet';
|
|
29
|
+
import BottomSheetTextInput from './BottomSheetTextInput';
|
|
30
|
+
import bottomSheetMeta from '@gorhom/bottom-sheet/package.json';
|
|
29
31
|
|
|
30
32
|
import { useApi, useInterval, useNav, useDeviceFingerprint } from '../hooks';
|
|
31
33
|
import { useGlobalContext } from './GlobalContext';
|
|
@@ -482,17 +484,23 @@ export function SignIn() {
|
|
|
482
484
|
[]
|
|
483
485
|
);
|
|
484
486
|
|
|
487
|
+
let extraBottomSheetProps: any = {};
|
|
488
|
+
if (bottomSheetMeta.version.startsWith('4')) {
|
|
489
|
+
extraBottomSheetProps.keyboardBehavior = 'fillParent';
|
|
490
|
+
extraBottomSheetProps.android_keyboardInputMode = 'adjustResize';
|
|
491
|
+
extraBottomSheetProps.enablePanDownToClose =
|
|
492
|
+
state.nav.options.type === 'error';
|
|
493
|
+
}
|
|
494
|
+
|
|
485
495
|
return (
|
|
486
496
|
<BottomSheetModal
|
|
487
497
|
snapPoints={snapPoints}
|
|
488
498
|
index={1}
|
|
489
499
|
backdropComponent={renderBackdrop}
|
|
490
|
-
keyboardBehavior="fillParent"
|
|
491
|
-
android_keyboardInputMode="adjustResize"
|
|
492
|
-
enablePanDownToClose={true}
|
|
493
500
|
onDismiss={handleClose}
|
|
494
501
|
style={styles.bottomSheet}
|
|
495
502
|
ref={bottomSheetModalRef}
|
|
503
|
+
{...extraBottomSheetProps}
|
|
496
504
|
>
|
|
497
505
|
<View style={styles.innerContainer}>
|
|
498
506
|
{step === LoginStep.INIT && (
|
|
@@ -515,7 +523,7 @@ export function SignIn() {
|
|
|
515
523
|
returnKeyType="go"
|
|
516
524
|
enablesReturnKeyAutomatically={true}
|
|
517
525
|
autoCapitalize="none"
|
|
518
|
-
onChangeText={(text) => setUserIdentifier(text.trim())}
|
|
526
|
+
onChangeText={(text: string) => setUserIdentifier(text.trim())}
|
|
519
527
|
onBlur={validateInput}
|
|
520
528
|
value={userIdentifier}
|
|
521
529
|
onSubmitEditing={initSignIn}
|
|
@@ -530,20 +538,17 @@ export function SignIn() {
|
|
|
530
538
|
: 'onChange']: handleAddlFieldChange,
|
|
531
539
|
});
|
|
532
540
|
})}
|
|
533
|
-
<
|
|
534
|
-
style={({ pressed }: { pressed: boolean }) => [
|
|
535
|
-
styles.button,
|
|
536
|
-
!isValidUserIdentifier && styles.buttonDisabled,
|
|
537
|
-
pressed && styles.buttonPressed,
|
|
538
|
-
isSubmitting && styles.buttonSubmitting,
|
|
539
|
-
]}
|
|
541
|
+
<TouchableOpacity
|
|
540
542
|
disabled={!isValidUserIdentifier || isSubmitting}
|
|
541
543
|
onPress={initSignIn}
|
|
542
544
|
>
|
|
543
|
-
<
|
|
544
|
-
{
|
|
545
|
-
|
|
546
|
-
|
|
545
|
+
<View
|
|
546
|
+
style={{
|
|
547
|
+
...styles.button,
|
|
548
|
+
...(!isValidUserIdentifier && styles.buttonDisabled),
|
|
549
|
+
...(isSubmitting && styles.buttonSubmitting),
|
|
550
|
+
}}
|
|
551
|
+
>
|
|
547
552
|
<View style={styles.buttonText}>
|
|
548
553
|
<Text
|
|
549
554
|
style={
|
|
@@ -555,11 +560,18 @@ export function SignIn() {
|
|
|
555
560
|
}
|
|
556
561
|
}
|
|
557
562
|
>
|
|
563
|
+
{isSubmitting && (
|
|
564
|
+
<ActivityIndicator
|
|
565
|
+
size="small"
|
|
566
|
+
color="#efefef"
|
|
567
|
+
style={styles.loadingIndicator}
|
|
568
|
+
/>
|
|
569
|
+
)}
|
|
558
570
|
{isSubmitting ? 'Just a sec...' : 'Continue'}
|
|
559
571
|
</Text>
|
|
560
572
|
</View>
|
|
561
|
-
</
|
|
562
|
-
</
|
|
573
|
+
</View>
|
|
574
|
+
</TouchableOpacity>
|
|
563
575
|
<Text style={styles.signInNoticeText}>
|
|
564
576
|
By continuing, you're agreeing to the terms of service that govern
|
|
565
577
|
this app and to receive email or text messages for verification
|
|
@@ -594,18 +606,15 @@ export function SignIn() {
|
|
|
594
606
|
)}
|
|
595
607
|
</View>
|
|
596
608
|
|
|
597
|
-
<
|
|
598
|
-
style={
|
|
599
|
-
styles.button,
|
|
600
|
-
pressed && styles.buttonPressed,
|
|
601
|
-
]}
|
|
609
|
+
<TouchableOpacity
|
|
610
|
+
style={[styles.button]}
|
|
602
611
|
onPress={() => setStep(LoginStep.INIT)}
|
|
603
612
|
>
|
|
604
613
|
<Text style={styles.buttonContent}>
|
|
605
614
|
Try a different{' '}
|
|
606
615
|
{loginType === 'phone' ? 'phone number' : 'email'}
|
|
607
616
|
</Text>
|
|
608
|
-
</
|
|
617
|
+
</TouchableOpacity>
|
|
609
618
|
</>
|
|
610
619
|
)}
|
|
611
620
|
|
|
@@ -620,12 +629,12 @@ export function SignIn() {
|
|
|
620
629
|
{step === LoginStep.FAILURE && (
|
|
621
630
|
<>
|
|
622
631
|
<Text style={tw.style('text-base')}>Whoops, that didn't work!</Text>
|
|
623
|
-
<
|
|
632
|
+
<TouchableOpacity
|
|
624
633
|
style={styles.button}
|
|
625
634
|
onPress={() => setStep(LoginStep.INIT)}
|
|
626
635
|
>
|
|
627
636
|
<Text style={styles.buttonContent}>Try again</Text>
|
|
628
|
-
</
|
|
637
|
+
</TouchableOpacity>
|
|
629
638
|
</>
|
|
630
639
|
)}
|
|
631
640
|
|
|
@@ -635,12 +644,12 @@ export function SignIn() {
|
|
|
635
644
|
An error occurred while signing you in.
|
|
636
645
|
</Text>
|
|
637
646
|
{!!error && <Text style={tw.style('text-rose-800')}>{error}</Text>}
|
|
638
|
-
<
|
|
647
|
+
<TouchableOpacity
|
|
639
648
|
style={styles.button}
|
|
640
649
|
onPress={() => setStep(LoginStep.INIT)}
|
|
641
650
|
>
|
|
642
651
|
<Text style={styles.buttonContent}>Try again</Text>
|
|
643
|
-
</
|
|
652
|
+
</TouchableOpacity>
|
|
644
653
|
</>
|
|
645
654
|
)}
|
|
646
655
|
<Text>
|
|
@@ -722,9 +731,11 @@ const styles = StyleSheet.create({
|
|
|
722
731
|
marginBottom: 30,
|
|
723
732
|
elevation: 0,
|
|
724
733
|
backgroundColor: '#5b0ae0',
|
|
734
|
+
color: '#fff',
|
|
725
735
|
display: 'flex',
|
|
726
736
|
alignItems: 'center',
|
|
727
737
|
justifyContent: 'center',
|
|
738
|
+
// height: 45,
|
|
728
739
|
},
|
|
729
740
|
buttonDisabled: {
|
|
730
741
|
backgroundColor: '#eee',
|
|
@@ -738,9 +749,10 @@ const styles = StyleSheet.create({
|
|
|
738
749
|
color: '#fff',
|
|
739
750
|
},
|
|
740
751
|
buttonText: {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
fontSize: 18,
|
|
752
|
+
// marginHorizontal: 10,
|
|
753
|
+
// paddingHorizontal: 10,
|
|
754
|
+
// fontSize: 18,
|
|
755
|
+
// color: '#fff',
|
|
744
756
|
},
|
|
745
757
|
buttonTextInner: {
|
|
746
758
|
fontSize: 18,
|
|
@@ -753,9 +765,7 @@ const styles = StyleSheet.create({
|
|
|
753
765
|
color: '#c7c7c7',
|
|
754
766
|
},
|
|
755
767
|
loadingIndicator: {
|
|
756
|
-
|
|
757
|
-
padding: 20,
|
|
758
|
-
margin: 20,
|
|
768
|
+
marginRight: 10,
|
|
759
769
|
},
|
|
760
770
|
signInNoticeText: {
|
|
761
771
|
fontSize: 12,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Svg, { SvgProps, Path } from 'react-native-svg';
|
|
3
|
+
/* SVGR has dropped some elements not supported by react-native-svg: title */
|
|
4
|
+
|
|
5
|
+
const SvgComponent = (props: SvgProps) => (
|
|
6
|
+
<Svg width={24} height={24} xmlns="http://www.w3.org/2000/svg" {...props}>
|
|
7
|
+
<Path d="M0 0h48v1H0z" fill="#DA1E28" fillRule="evenodd" />
|
|
8
|
+
</Svg>
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export default SvgComponent;
|