forked from GeekyAnts/NativeBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request GeekyAnts#3342 from GeekyAnts/feat/v3-factory
Feat/v3 factory
- Loading branch information
Showing
3 changed files
with
27 additions
and
4 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
21 changes: 21 additions & 0 deletions
21
example/storybook/stories/components/composites/factory/ref.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,21 @@ | ||
import React from 'react'; | ||
import { NBFactory, Button } from 'native-base'; | ||
import { TextInput } from 'react-native'; | ||
|
||
export default function () { | ||
const NBInput = NBFactory(TextInput); | ||
const inputRef = React.useRef(null); | ||
return ( | ||
<> | ||
<NBInput ref={inputRef} height={10} border={1} borderColor="cyan.400" /> | ||
<Button | ||
onPress={() => { | ||
// @ts-ignore | ||
inputRef?.current?.focus(); | ||
}} | ||
> | ||
Set Focus | ||
</Button> | ||
</> | ||
); | ||
} |
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