@@ -20,7 +20,6 @@ The content of index.io.js could be something like
20
20
For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer
21
21
*/
22
22
23
- import * as PropTypes from 'prop-types' ;
24
23
import * as React from 'react' ;
25
24
import {
26
25
AccessibilityInfo ,
@@ -625,7 +624,7 @@ export class TouchableNativeFeedbackTest extends React.Component {
625
624
626
625
// PressableTest
627
626
export class PressableTest extends React . Component < { } > {
628
- private readonly myRef : React . RefObject < View > = React . createRef ( ) ;
627
+ private readonly myRef : React . RefObject < View | null > = React . createRef ( ) ;
629
628
630
629
onPressButton = ( e : GestureResponderEvent ) => {
631
630
e . persist ( ) ;
@@ -806,7 +805,9 @@ export class FlatListTest extends React.Component<FlatListProps<number>, {}> {
806
805
render ( ) {
807
806
return (
808
807
< FlatList
809
- ref = { list => ( this . list = list ) }
808
+ ref = { list => {
809
+ this . list = list ;
810
+ } }
810
811
data = { [ 1 , 2 , 3 , 4 , 5 ] }
811
812
renderItem = { this . _renderItem }
812
813
ItemSeparatorComponent = { this . _renderSeparator }
@@ -846,7 +847,7 @@ export class SectionListTest extends React.Component<
846
847
SectionListProps < string > ,
847
848
{ }
848
849
> {
849
- myList : React . RefObject < SectionList < string > > ;
850
+ myList : React . RefObject < SectionList < string > | null > ;
850
851
851
852
constructor ( props : SectionListProps < string > ) {
852
853
super ( props ) ;
@@ -920,7 +921,7 @@ export class SectionListTypedSectionTest extends React.Component<
920
921
SectionListProps < string , SectionT > ,
921
922
{ }
922
923
> {
923
- myList : React . RefObject < SectionList < string , SectionT > > ;
924
+ myList : React . RefObject < SectionList < string , SectionT > | null > ;
924
925
925
926
constructor ( props : SectionListProps < string , SectionT > ) {
926
927
super ( props ) ;
@@ -1248,7 +1249,9 @@ class TextInputTest extends React.Component<{}, {username: string}> {
1248
1249
</ Text >
1249
1250
1250
1251
< TextInput
1251
- ref = { input => ( this . username = input ) }
1252
+ ref = { input => {
1253
+ this . username = input ;
1254
+ } }
1252
1255
textContentType = "username"
1253
1256
autoComplete = "username"
1254
1257
value = { this . state . username }
@@ -1535,10 +1538,6 @@ const NativeBridgedComponent = requireNativeComponent<{nativeProp: string}>(
1535
1538
) ;
1536
1539
1537
1540
class BridgedComponentTest extends React . Component {
1538
- static propTypes = {
1539
- jsProp : PropTypes . string . isRequired ,
1540
- } ;
1541
-
1542
1541
nativeComponentRef : React . ElementRef < typeof NativeBridgedComponent > | null ;
1543
1542
1544
1543
callNativeMethod = ( ) => {
@@ -1563,7 +1562,9 @@ class BridgedComponentTest extends React.Component {
1563
1562
< NativeBridgedComponent
1564
1563
{ ...this . props }
1565
1564
nativeProp = "test"
1566
- ref = { ref => ( this . nativeComponentRef = ref ) }
1565
+ ref = { ref => {
1566
+ this . nativeComponentRef = ref ;
1567
+ } }
1567
1568
/>
1568
1569
) ;
1569
1570
}
0 commit comments