@rownd/react-native 0.1.11 → 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.
Files changed (45) hide show
  1. package/README.md +15 -6
  2. package/lib/commonjs/assets/images/error-icon-material.svg +1 -0
  3. package/lib/commonjs/components/AutoSigninDialog.js +21 -14
  4. package/lib/commonjs/components/AutoSigninDialog.js.map +1 -1
  5. package/lib/commonjs/components/BottomSheetTextInput/BottomSheetTextInput.js +65 -0
  6. package/lib/commonjs/components/BottomSheetTextInput/BottomSheetTextInput.js.map +1 -0
  7. package/lib/commonjs/components/BottomSheetTextInput/index.js +16 -0
  8. package/lib/commonjs/components/BottomSheetTextInput/index.js.map +1 -0
  9. package/lib/commonjs/components/BottomSheetTextInput/types.js +6 -0
  10. package/lib/commonjs/components/BottomSheetTextInput/types.js.map +1 -0
  11. package/lib/commonjs/components/RowndComponents.js +4 -6
  12. package/lib/commonjs/components/RowndComponents.js.map +1 -1
  13. package/lib/commonjs/components/SignIn.js +39 -35
  14. package/lib/commonjs/components/SignIn.js.map +1 -1
  15. package/lib/commonjs/components/images/ErrorIcon.js +31 -0
  16. package/lib/commonjs/components/images/ErrorIcon.js.map +1 -0
  17. package/lib/module/assets/images/error-icon-material.svg +1 -0
  18. package/lib/module/components/AutoSigninDialog.js +17 -13
  19. package/lib/module/components/AutoSigninDialog.js.map +1 -1
  20. package/lib/module/components/BottomSheetTextInput/BottomSheetTextInput.js +52 -0
  21. package/lib/module/components/BottomSheetTextInput/BottomSheetTextInput.js.map +1 -0
  22. package/lib/module/components/BottomSheetTextInput/index.js +3 -0
  23. package/lib/module/components/BottomSheetTextInput/index.js.map +1 -0
  24. package/lib/module/components/BottomSheetTextInput/types.js +2 -0
  25. package/lib/module/components/BottomSheetTextInput/types.js.map +1 -0
  26. package/lib/module/components/RowndComponents.js +5 -5
  27. package/lib/module/components/RowndComponents.js.map +1 -1
  28. package/lib/module/components/SignIn.js +38 -36
  29. package/lib/module/components/SignIn.js.map +1 -1
  30. package/lib/module/components/images/ErrorIcon.js +18 -0
  31. package/lib/module/components/images/ErrorIcon.js.map +1 -0
  32. package/lib/package.json +3 -5
  33. package/lib/typescript/src/components/BottomSheetTextInput/BottomSheetTextInput.d.ts +4 -0
  34. package/lib/typescript/src/components/BottomSheetTextInput/index.d.ts +2 -0
  35. package/lib/typescript/src/components/BottomSheetTextInput/types.d.ts +3 -0
  36. package/lib/typescript/src/components/images/ErrorIcon.d.ts +4 -0
  37. package/package.json +3 -5
  38. package/src/assets/images/error-icon-material.svg +1 -0
  39. package/src/components/AutoSigninDialog.tsx +16 -10
  40. package/src/components/BottomSheetTextInput/BottomSheetTextInput.tsx +57 -0
  41. package/src/components/BottomSheetTextInput/index.ts +5 -0
  42. package/src/components/BottomSheetTextInput/types.ts +3 -0
  43. package/src/components/RowndComponents.tsx +3 -3
  44. package/src/components/SignIn.tsx +44 -35
  45. package/src/components/images/ErrorIcon.tsx +11 -0
@@ -0,0 +1,3 @@
1
+ import type { TextInputProps } from 'react-native';
2
+
3
+ export interface BottomSheetTextInputProps extends TextInputProps {}
@@ -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,7 +10,7 @@ import { differenceInMinutes } from 'date-fns';
10
10
  import {
11
11
  View,
12
12
  StyleSheet,
13
- Pressable,
13
+ TouchableOpacity,
14
14
  Image,
15
15
  ActivityIndicator,
16
16
  Linking,
@@ -25,8 +25,9 @@ import {
25
25
  BottomSheetBackdrop,
26
26
  BottomSheetBackdropProps,
27
27
  BottomSheetModal,
28
- BottomSheetTextInput,
29
28
  } from '@gorhom/bottom-sheet';
29
+ import BottomSheetTextInput from './BottomSheetTextInput';
30
+ import bottomSheetMeta from '@gorhom/bottom-sheet/package.json';
30
31
 
31
32
  import { useApi, useInterval, useNav, useDeviceFingerprint } from '../hooks';
32
33
  import { useGlobalContext } from './GlobalContext';
@@ -483,17 +484,23 @@ export function SignIn() {
483
484
  []
484
485
  );
485
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
+
486
495
  return (
487
496
  <BottomSheetModal
488
497
  snapPoints={snapPoints}
489
498
  index={1}
490
499
  backdropComponent={renderBackdrop}
491
- keyboardBehavior="fillParent"
492
- android_keyboardInputMode="adjustResize"
493
- enablePanDownToClose={true}
494
500
  onDismiss={handleClose}
495
501
  style={styles.bottomSheet}
496
502
  ref={bottomSheetModalRef}
503
+ {...extraBottomSheetProps}
497
504
  >
498
505
  <View style={styles.innerContainer}>
499
506
  {step === LoginStep.INIT && (
@@ -516,7 +523,7 @@ export function SignIn() {
516
523
  returnKeyType="go"
517
524
  enablesReturnKeyAutomatically={true}
518
525
  autoCapitalize="none"
519
- onChangeText={(text) => setUserIdentifier(text.trim())}
526
+ onChangeText={(text: string) => setUserIdentifier(text.trim())}
520
527
  onBlur={validateInput}
521
528
  value={userIdentifier}
522
529
  onSubmitEditing={initSignIn}
@@ -531,20 +538,17 @@ export function SignIn() {
531
538
  : 'onChange']: handleAddlFieldChange,
532
539
  });
533
540
  })}
534
- <Pressable
535
- style={({ pressed }: { pressed: boolean }) => [
536
- styles.button,
537
- !isValidUserIdentifier && styles.buttonDisabled,
538
- pressed && styles.buttonPressed,
539
- isSubmitting && styles.buttonSubmitting,
540
- ]}
541
+ <TouchableOpacity
541
542
  disabled={!isValidUserIdentifier || isSubmitting}
542
543
  onPress={initSignIn}
543
544
  >
544
- <Text>
545
- {isSubmitting && (
546
- <ActivityIndicator size="small" color="#efefef" />
547
- )}
545
+ <View
546
+ style={{
547
+ ...styles.button,
548
+ ...(!isValidUserIdentifier && styles.buttonDisabled),
549
+ ...(isSubmitting && styles.buttonSubmitting),
550
+ }}
551
+ >
548
552
  <View style={styles.buttonText}>
549
553
  <Text
550
554
  style={
@@ -556,11 +560,18 @@ export function SignIn() {
556
560
  }
557
561
  }
558
562
  >
563
+ {isSubmitting && (
564
+ <ActivityIndicator
565
+ size="small"
566
+ color="#efefef"
567
+ style={styles.loadingIndicator}
568
+ />
569
+ )}
559
570
  {isSubmitting ? 'Just a sec...' : 'Continue'}
560
571
  </Text>
561
572
  </View>
562
- </Text>
563
- </Pressable>
573
+ </View>
574
+ </TouchableOpacity>
564
575
  <Text style={styles.signInNoticeText}>
565
576
  By continuing, you're agreeing to the terms of service that govern
566
577
  this app and to receive email or text messages for verification
@@ -595,18 +606,15 @@ export function SignIn() {
595
606
  )}
596
607
  </View>
597
608
 
598
- <Pressable
599
- style={({ pressed }: { pressed: boolean }) => [
600
- styles.button,
601
- pressed && styles.buttonPressed,
602
- ]}
609
+ <TouchableOpacity
610
+ style={[styles.button]}
603
611
  onPress={() => setStep(LoginStep.INIT)}
604
612
  >
605
613
  <Text style={styles.buttonContent}>
606
614
  Try a different{' '}
607
615
  {loginType === 'phone' ? 'phone number' : 'email'}
608
616
  </Text>
609
- </Pressable>
617
+ </TouchableOpacity>
610
618
  </>
611
619
  )}
612
620
 
@@ -621,12 +629,12 @@ export function SignIn() {
621
629
  {step === LoginStep.FAILURE && (
622
630
  <>
623
631
  <Text style={tw.style('text-base')}>Whoops, that didn't work!</Text>
624
- <Pressable
632
+ <TouchableOpacity
625
633
  style={styles.button}
626
634
  onPress={() => setStep(LoginStep.INIT)}
627
635
  >
628
636
  <Text style={styles.buttonContent}>Try again</Text>
629
- </Pressable>
637
+ </TouchableOpacity>
630
638
  </>
631
639
  )}
632
640
 
@@ -636,12 +644,12 @@ export function SignIn() {
636
644
  An error occurred while signing you in.
637
645
  </Text>
638
646
  {!!error && <Text style={tw.style('text-rose-800')}>{error}</Text>}
639
- <Pressable
647
+ <TouchableOpacity
640
648
  style={styles.button}
641
649
  onPress={() => setStep(LoginStep.INIT)}
642
650
  >
643
651
  <Text style={styles.buttonContent}>Try again</Text>
644
- </Pressable>
652
+ </TouchableOpacity>
645
653
  </>
646
654
  )}
647
655
  <Text>
@@ -723,9 +731,11 @@ const styles = StyleSheet.create({
723
731
  marginBottom: 30,
724
732
  elevation: 0,
725
733
  backgroundColor: '#5b0ae0',
734
+ color: '#fff',
726
735
  display: 'flex',
727
736
  alignItems: 'center',
728
737
  justifyContent: 'center',
738
+ // height: 45,
729
739
  },
730
740
  buttonDisabled: {
731
741
  backgroundColor: '#eee',
@@ -739,9 +749,10 @@ const styles = StyleSheet.create({
739
749
  color: '#fff',
740
750
  },
741
751
  buttonText: {
742
- marginLeft: 10,
743
- paddingLeft: 10,
744
- fontSize: 18,
752
+ // marginHorizontal: 10,
753
+ // paddingHorizontal: 10,
754
+ // fontSize: 18,
755
+ // color: '#fff',
745
756
  },
746
757
  buttonTextInner: {
747
758
  fontSize: 18,
@@ -754,9 +765,7 @@ const styles = StyleSheet.create({
754
765
  color: '#c7c7c7',
755
766
  },
756
767
  loadingIndicator: {
757
- textAlignVertical: 'center',
758
- padding: 20,
759
- margin: 20,
768
+ marginRight: 10,
760
769
  },
761
770
  signInNoticeText: {
762
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;