-
Notifications
You must be signed in to change notification settings - Fork 734
New Dialog using the new Pan and Transition Views #1576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2de1405
Rename Direction to TransitionViewDirection
M-i-k-e-l acd8d13
New Dialog using the new Pan and Tranistion Views
M-i-k-e-l 6e1644e
Merge branch 'master' into feat/new-dialog
M-i-k-e-l a885119
Merge branch 'master' into feat/new-dialog
M-i-k-e-l 3a51c28
Remove gestureHandler style
M-i-k-e-l 80d926f
Remove extra view
M-i-k-e-l b01ea10
Add TODO
M-i-k-e-l eb7a1ab
Merge branch 'master' into feat/new-dialog
M-i-k-e-l ec28ab0
Add union type + each component has its own statics and types
M-i-k-e-l 6a25fdc
Fix import in tests
M-i-k-e-l 5999c07
PR fixes
M-i-k-e-l 5dde305
Merge branch 'master' into feat/new-dialog
M-i-k-e-l cbe8cc7
Move types to PanView
M-i-k-e-l 6c383cd
Merge branch 'master' into feat/new-dialog
M-i-k-e-l 26d7f73
Merge branch 'master' into feat/new-dialog
M-i-k-e-l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
102 changes: 102 additions & 0 deletions
102
demo/src/screens/incubatorScreens/IncubatorDialogScreen.tsx
This file contains hidden or 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,102 @@ | ||
import React, {Component} from 'react'; | ||
import {StyleSheet} from 'react-native'; | ||
import {FlatList} from 'react-native-gesture-handler'; | ||
import {View, Text, Card, Button, Incubator, Colors, BorderRadiuses} from 'react-native-ui-lib'; //eslint-disable-line | ||
|
||
interface Item { | ||
value: string; | ||
label: string; | ||
} | ||
|
||
const colors: Item[] = [ | ||
{value: Colors.red10, label: 'Red10'}, | ||
{value: Colors.red30, label: 'Red30'}, | ||
{value: Colors.red50, label: 'Red50'}, | ||
{value: Colors.red70, label: 'Red70'}, | ||
{value: Colors.blue10, label: 'Blue10'}, | ||
{value: Colors.blue30, label: 'Blue30'}, | ||
{value: Colors.blue50, label: 'Blue50'}, | ||
{value: Colors.blue70, label: 'Blue70'}, | ||
{value: Colors.purple10, label: 'Purple10'}, | ||
{value: Colors.purple30, label: 'Purple30'}, | ||
{value: Colors.purple50, label: 'Purple50'}, | ||
{value: Colors.purple70, label: 'Purple70'}, | ||
{value: Colors.green10, label: 'Green10'}, | ||
{value: Colors.green30, label: 'Green30'}, | ||
{value: Colors.green50, label: 'Green50'}, | ||
{value: Colors.green70, label: 'Green70'}, | ||
{value: Colors.yellow10, label: 'Yellow10'}, | ||
{value: Colors.yellow30, label: 'Yellow30'}, | ||
{value: Colors.yellow50, label: 'Yellow50'}, | ||
{value: Colors.yellow70, label: 'Yellow70'} | ||
]; | ||
|
||
export default class IncubatorDialogScreen extends Component { | ||
state = {visible: false}; | ||
|
||
renderVerticalItem = ({item}: {item: Item}) => { | ||
return ( | ||
<Text text50 margin-20 color={item.value}> | ||
{item.label} | ||
</Text> | ||
); | ||
}; | ||
|
||
keyExtractor = (item: Item) => { | ||
return item.value; | ||
}; | ||
|
||
openDialog = () => { | ||
this.setState({visible: true}); | ||
}; | ||
|
||
closeDialog = () => { | ||
this.setState({visible: false}); | ||
}; | ||
|
||
render() { | ||
const {visible} = this.state; | ||
|
||
return ( | ||
<View bg-dark80 flex padding-20> | ||
<Card height={100} center padding-20> | ||
<Text text50>IncubatorDialogScreen</Text> | ||
</Card> | ||
<View flex center> | ||
<Button marginV-20 label="Open Dialog" onPress={this.openDialog}/> | ||
</View> | ||
<Incubator.Dialog visible={visible} onDismiss={this.closeDialog} bottom containerStyle={styles.dialogContainer}> | ||
<View style={styles.dialog}> | ||
<Text text60 margin-s2> | ||
Title (swipe here) | ||
</Text> | ||
<View height={1} bg-grey40/> | ||
<FlatList | ||
showsVerticalScrollIndicator={false} | ||
style={styles.verticalScroll} | ||
data={colors} | ||
renderItem={this.renderVerticalItem} | ||
keyExtractor={this.keyExtractor} | ||
/> | ||
</View> | ||
</Incubator.Dialog> | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
dialogContainer: { | ||
bottom: 20, | ||
alignSelf: 'center' | ||
}, | ||
dialog: { | ||
backgroundColor: Colors.white, | ||
width: 200, | ||
height: 300, | ||
borderRadius: BorderRadiuses.br20 | ||
}, | ||
verticalScroll: { | ||
marginTop: 20 | ||
} | ||
}); |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,50 @@ | ||
import { PropsWithChildren } from 'react'; | ||
import { StyleProp, ViewStyle } from 'react-native'; | ||
import { PanningDirections, PanningDirectionsEnum } from '../panView/panningUtil'; | ||
import { ModalProps } from '../../components/modal'; | ||
import { AlignmentModifiers } from '../../commons/modifiers'; | ||
declare type DialogDirections = PanningDirections; | ||
declare const DialogDirectionsEnum: typeof PanningDirectionsEnum; | ||
export { DialogDirections, DialogDirectionsEnum }; | ||
interface _DialogProps extends AlignmentModifiers { | ||
/** | ||
* Control visibility of the dialog. | ||
*/ | ||
visible?: boolean; | ||
/** | ||
* Callback that is called after the dialog's dismiss (after the animation has ended). | ||
*/ | ||
onDismiss?: (props?: DialogProps) => void; | ||
/** | ||
* The direction from which and to which the dialog is animating \ panning (default bottom). | ||
*/ | ||
direction?: DialogDirections; | ||
/** | ||
* The Dialog`s container style (it is set to {position: 'absolute'}) | ||
*/ | ||
containerStyle?: StyleProp<ViewStyle>; | ||
/** | ||
* Whether or not to ignore background press. | ||
*/ | ||
ignoreBackgroundPress?: boolean; | ||
/** | ||
* Additional props for the modal. | ||
*/ | ||
modalProps?: ModalProps; | ||
/** | ||
* Used to locate this view in end-to-end tests | ||
* The container has the unchanged id. | ||
* Currently supported inner IDs: | ||
* TODO: add missing <TestID>(s?) | ||
* <TestID>.modal - the Modal's id. | ||
* <TestID>.overlayFadingBackground - the fading background id. | ||
*/ | ||
testID?: string; | ||
} | ||
export declare type DialogProps = PropsWithChildren<_DialogProps>; | ||
declare const Dialog: { | ||
(props: DialogProps): JSX.Element; | ||
displayName: string; | ||
directions: typeof PanningDirectionsEnum; | ||
}; | ||
export default Dialog; |
This file contains hidden or 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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import React, { PropsWithChildren } from 'react'; | ||
import React from 'react'; | ||
import { ViewProps } from '../../components/view'; | ||
import { ForwardRefInjectedProps } from '../../commons/new'; | ||
import { Direction } from '../hooks/useHiddenLocation'; | ||
import { TransitionViewAnimationType } from './useAnimationEndNotifier'; | ||
import { TransitionViewDirection, TransitionViewDirectionEnum } from './useAnimatedTranslator'; | ||
import { AnimatedTransitionProps } from './useAnimatedTransition'; | ||
export { Direction, TransitionViewAnimationType }; | ||
export declare type TransitionViewProps = AnimatedTransitionProps & ViewProps; | ||
declare type Props = PropsWithChildren<TransitionViewProps> & ForwardRefInjectedProps; | ||
export { TransitionViewDirection, TransitionViewDirectionEnum, TransitionViewAnimationType }; | ||
export interface TransitionViewProps extends AnimatedTransitionProps, ViewProps { | ||
ref?: any; | ||
} | ||
interface Statics { | ||
animateOut: () => void; | ||
directions: typeof TransitionViewDirectionEnum; | ||
} | ||
declare const _default: React.ComponentType<Props> & Statics; | ||
declare const _default: React.ComponentType<TransitionViewProps> & Statics; | ||
export default _default; |
13 changes: 9 additions & 4 deletions
13
generatedTypes/src/incubator/TransitionView/useAnimatedTransition.d.ts
This file contains hidden or 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
8 changes: 5 additions & 3 deletions
8
generatedTypes/src/incubator/TransitionView/useAnimatedTranslator.d.ts
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.