-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: added
KeyboardAvoidingView
and KeyboardStickyView
comparison (
#262)
- Loading branch information
1 parent
468d750
commit e20c788
Showing
3 changed files
with
74 additions
and
46 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
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,46 @@ | ||
import React, { CSSProperties } from 'react'; | ||
import Lottie from 'lottie-react'; | ||
|
||
const withoutBorders = { border: 'none' }; | ||
const lottieView = { paddingLeft: '20%', paddingRight: '20%' }; | ||
const label: CSSProperties = { | ||
...withoutBorders, | ||
maxWidth: 400, | ||
textAlign: 'center', | ||
}; | ||
const labels = { | ||
...withoutBorders, | ||
backgroundColor: '#00000000', | ||
}; | ||
|
||
type Props = { | ||
leftLottie: unknown; | ||
leftText: React.ReactNode; | ||
rightLottie: unknown; | ||
rightText: React.ReactNode; | ||
}; | ||
|
||
export default function ComparisonTable({ leftLottie, leftText, rightLottie, rightText }: Props): JSX.Element { | ||
return ( | ||
<table> | ||
<tbody> | ||
<tr style={withoutBorders}> | ||
<td style={withoutBorders}> | ||
<Lottie animationData={leftLottie} style={lottieView} loop /> | ||
</td> | ||
<td style={withoutBorders}> | ||
<Lottie animationData={rightLottie} style={lottieView} loop /> | ||
</td> | ||
</tr> | ||
<tr style={labels}> | ||
<td style={label}> | ||
{leftText} | ||
</td> | ||
<td style={label}> | ||
{rightText} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
); | ||
} |
56 changes: 17 additions & 39 deletions
56
docs/src/components/KeyboardAvoidingViewComparison/index.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 |
---|---|---|
@@ -1,47 +1,25 @@ | ||
import React, { CSSProperties } from 'react'; | ||
import Lottie from 'lottie-react'; | ||
import React from 'react'; | ||
|
||
import before from './kav.lottie.json'; | ||
import after from './kav-animated.lottie.json'; | ||
|
||
const withoutBorders = { border: 'none' }; | ||
const lottieView = { paddingLeft: '20%', paddingRight: '20%' }; | ||
const label: CSSProperties = { | ||
...withoutBorders, | ||
maxWidth: 400, | ||
textAlign: 'center', | ||
}; | ||
const labels = { | ||
...withoutBorders, | ||
backgroundColor: '#00000000', | ||
}; | ||
import ComparisonTable from '../ComparisonTable'; | ||
|
||
export default function KeyboardAvoidingViewComparison(): JSX.Element { | ||
return ( | ||
<table> | ||
<tbody> | ||
<tr style={withoutBorders}> | ||
<td style={withoutBorders}> | ||
<Lottie animationData={before} style={lottieView} loop /> | ||
</td> | ||
<td style={withoutBorders}> | ||
<Lottie animationData={after} style={lottieView} loop /> | ||
</td> | ||
</tr> | ||
<tr style={labels}> | ||
<td style={label}> | ||
<i> | ||
Default <code>react-native</code> implementation on Android | ||
</i> | ||
</td> | ||
<td style={label}> | ||
<i> | ||
Implementation from <code>react-native-keyboard-controller</code>{' '} | ||
with better animations | ||
</i> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<ComparisonTable | ||
leftLottie={before} | ||
rightLottie={after} | ||
leftText={ | ||
<i> | ||
Default <code>react-native</code> implementation on Android | ||
</i> | ||
} | ||
rightText={ | ||
<i> | ||
Implementation from <code>react-native-keyboard-controller</code>{' '} | ||
with better animations | ||
</i> | ||
} | ||
/> | ||
); | ||
} |