Add composer FAB to home page
parent
4aa8a58f27
commit
b3b2cfe909
|
@ -1,5 +1,7 @@
|
||||||
PODS:
|
PODS:
|
||||||
- boost (1.76.0)
|
- boost (1.76.0)
|
||||||
|
- BVLinearGradient (2.6.2):
|
||||||
|
- React-Core
|
||||||
- DoubleConversion (1.1.6)
|
- DoubleConversion (1.1.6)
|
||||||
- FBLazyVector (0.68.2)
|
- FBLazyVector (0.68.2)
|
||||||
- FBReactNativeSpec (0.68.2):
|
- FBReactNativeSpec (0.68.2):
|
||||||
|
@ -333,6 +335,7 @@ PODS:
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
|
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
|
||||||
|
- BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
|
||||||
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
|
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
|
||||||
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
|
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
|
||||||
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
|
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
|
||||||
|
@ -381,6 +384,8 @@ SPEC REPOS:
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
boost:
|
boost:
|
||||||
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
|
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
|
||||||
|
BVLinearGradient:
|
||||||
|
:path: "../node_modules/react-native-linear-gradient"
|
||||||
DoubleConversion:
|
DoubleConversion:
|
||||||
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
|
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
|
||||||
FBLazyVector:
|
FBLazyVector:
|
||||||
|
@ -460,6 +465,7 @@ EXTERNAL SOURCES:
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
boost: a7c83b31436843459a1961bfd74b96033dc77234
|
boost: a7c83b31436843459a1961bfd74b96033dc77234
|
||||||
|
BVLinearGradient: 34a999fda29036898a09c6a6b728b0b4189e1a44
|
||||||
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
|
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
|
||||||
FBLazyVector: a7a655862f6b09625d11c772296b01cd5164b648
|
FBLazyVector: a7a655862f6b09625d11c772296b01cd5164b648
|
||||||
FBReactNativeSpec: 81ce99032d5b586fddd6a38d450f8595f7e04be4
|
FBReactNativeSpec: 81ce99032d5b586fddd6a38d450f8595f7e04be4
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
"react-native": "0.68.2",
|
"react-native": "0.68.2",
|
||||||
"react-native-gesture-handler": "^2.5.0",
|
"react-native-gesture-handler": "^2.5.0",
|
||||||
"react-native-inappbrowser-reborn": "^3.6.3",
|
"react-native-inappbrowser-reborn": "^3.6.3",
|
||||||
|
"react-native-linear-gradient": "^2.6.2",
|
||||||
"react-native-progress": "^5.0.0",
|
"react-native-progress": "^5.0.0",
|
||||||
"react-native-reanimated": "^2.9.1",
|
"react-native-reanimated": "^2.9.1",
|
||||||
"react-native-root-siblings": "^4.1.1",
|
"react-native-root-siblings": "^4.1.1",
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
import React from 'react'
|
||||||
|
import {GestureResponderEvent, StyleSheet, TouchableOpacity} from 'react-native'
|
||||||
|
import LinearGradient from 'react-native-linear-gradient'
|
||||||
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
|
import {IconProp} from '@fortawesome/fontawesome-svg-core'
|
||||||
|
import {colors, gradients} from '../../lib/styles'
|
||||||
|
import * as zIndex from '../../lib/z-index'
|
||||||
|
|
||||||
|
type OnPress = ((event: GestureResponderEvent) => void) | undefined
|
||||||
|
export function FAB({icon, onPress}: {icon: IconProp; onPress: OnPress}) {
|
||||||
|
return (
|
||||||
|
<TouchableOpacity style={styles.outer} onPress={onPress}>
|
||||||
|
<LinearGradient
|
||||||
|
colors={[gradients.primary.start, gradients.primary.end]}
|
||||||
|
start={{x: 0, y: 0}}
|
||||||
|
end={{x: 1, y: 1}}
|
||||||
|
style={styles.inner}>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
size={20}
|
||||||
|
icon={icon}
|
||||||
|
color={colors.white}
|
||||||
|
style={styles.icon}
|
||||||
|
/>
|
||||||
|
</LinearGradient>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
outer: {
|
||||||
|
position: 'absolute',
|
||||||
|
zIndex: zIndex.FAB,
|
||||||
|
right: 20,
|
||||||
|
bottom: 20,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
borderRadius: 25,
|
||||||
|
shadowColor: '#000',
|
||||||
|
shadowOpacity: 0.3,
|
||||||
|
shadowOffset: {width: 0, height: 1},
|
||||||
|
},
|
||||||
|
inner: {
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
borderRadius: 25,
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
icon: {},
|
||||||
|
})
|
|
@ -0,0 +1,2 @@
|
||||||
|
export const FAB = 1
|
||||||
|
export const BASE = 0
|
|
@ -2,6 +2,7 @@ import React, {useState, useEffect, useLayoutEffect} from 'react'
|
||||||
import {Image, StyleSheet, TouchableOpacity, View} from 'react-native'
|
import {Image, StyleSheet, TouchableOpacity, View} from 'react-native'
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {Feed} from '../com/feed/Feed'
|
import {Feed} from '../com/feed/Feed'
|
||||||
|
import {FAB} from '../com/util/FloatingActionButton'
|
||||||
import {useStores} from '../../state'
|
import {useStores} from '../../state'
|
||||||
import {useLoadEffect} from '../lib/navigation'
|
import {useLoadEffect} from '../lib/navigation'
|
||||||
import {AVIS} from '../lib/assets'
|
import {AVIS} from '../lib/assets'
|
||||||
|
@ -48,9 +49,14 @@ export function Home({params}: ScreenParams) {
|
||||||
// })
|
// })
|
||||||
// }, [navigation])
|
// }, [navigation])
|
||||||
|
|
||||||
|
const onComposePress = () => {
|
||||||
|
store.nav.navigate('/compose')
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<Feed feed={store.homeFeed} />
|
<Feed feed={store.homeFeed} />
|
||||||
|
<FAB icon="pen-nib" onPress={onComposePress} />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,4 @@ Paul's todo list
|
||||||
- Restore all functionality that was disabled during the refactor
|
- Restore all functionality that was disabled during the refactor
|
||||||
- Reduce extraneous triggers of useLoadEffect
|
- Reduce extraneous triggers of useLoadEffect
|
||||||
- Bugs
|
- Bugs
|
||||||
- Home screen goes white sometimes, not sure why
|
- Home screen goes white sometimes, not sure why (possibly related to multiple active instances of the screen)
|
|
@ -11326,6 +11326,11 @@ react-native-inappbrowser-reborn@^3.6.3:
|
||||||
invariant "^2.2.4"
|
invariant "^2.2.4"
|
||||||
opencollective-postinstall "^2.0.2"
|
opencollective-postinstall "^2.0.2"
|
||||||
|
|
||||||
|
react-native-linear-gradient@^2.6.2:
|
||||||
|
version "2.6.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-native-linear-gradient/-/react-native-linear-gradient-2.6.2.tgz#56598a76832724b2afa7889747635b5c80948f38"
|
||||||
|
integrity sha512-Z8Xxvupsex+9BBFoSYS87bilNPWcRfRsGC0cpJk72Nxb5p2nEkGSBv73xZbEHnW2mUFvP+huYxrVvjZkr/gRjQ==
|
||||||
|
|
||||||
react-native-progress@^5.0.0:
|
react-native-progress@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-native-progress/-/react-native-progress-5.0.0.tgz#f5ac6ceaeee27f184c660b00f29419e82a9d0ab0"
|
resolved "https://registry.yarnpkg.com/react-native-progress/-/react-native-progress-5.0.0.tgz#f5ac6ceaeee27f184c660b00f29419e82a9d0ab0"
|
||||||
|
|
Loading…
Reference in New Issue