11import React from 'react' ;
2- import ReactNative from 'react-native' ;
2+ import { Text } from 'react-native' ;
33import PropTypes from 'prop-types' ;
44
55import TextExtraction from './lib/TextExtraction' ;
@@ -11,12 +11,12 @@ export const PATTERNS = {
1111} ;
1212
1313const defaultParseShape = PropTypes . shape ( {
14- ...ReactNative . Text . propTypes ,
14+ ...Text . propTypes ,
1515 type : PropTypes . oneOf ( Object . keys ( PATTERNS ) ) . isRequired ,
1616} ) ;
1717
1818const customParseShape = PropTypes . shape ( {
19- ...ReactNative . Text . propTypes ,
19+ ...Text . propTypes ,
2020 pattern : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . instanceOf ( RegExp ) ] ) . isRequired ,
2121} ) ;
2222
@@ -25,11 +25,11 @@ class ParsedText extends React.Component {
2525 static displayName = 'ParsedText' ;
2626
2727 static propTypes = {
28- ...ReactNative . Text . propTypes ,
28+ ...Text . propTypes ,
2929 parse : PropTypes . arrayOf (
3030 PropTypes . oneOfType ( [ defaultParseShape , customParseShape ] ) ,
3131 ) ,
32- childrenProps : PropTypes . shape ( ReactNative . Text . propTypes ) ,
32+ childrenProps : PropTypes . shape ( Text . propTypes ) ,
3333 } ;
3434
3535 static defaultProps = {
@@ -63,7 +63,7 @@ class ParsedText extends React.Component {
6363
6464 return textExtraction . parse ( ) . map ( ( props , index ) => {
6565 return (
66- < ReactNative . Text
66+ < Text
6767 key = { `parsedText-${ index } ` }
6868 { ...this . props . childrenProps }
6969 { ...props }
@@ -73,13 +73,13 @@ class ParsedText extends React.Component {
7373 }
7474
7575 render ( ) {
76- // Discard custom props before passing remainder to ReactNative. Text
76+ // Discard custom props before passing remainder to Text
7777 const { parse, childrenProps, ...remainder } = { ...this . props } ;
7878
7979 return (
80- < ReactNative . Text ref = { ref => ( this . _root = ref ) } { ...remainder } >
80+ < Text ref = { ref => ( this . _root = ref ) } { ...remainder } >
8181 { this . getParsedText ( ) }
82- </ ReactNative . Text >
82+ </ Text >
8383 ) ;
8484 }
8585}
0 commit comments