diff options
author | Ashm Walia <40498934+ashmgarv@users.noreply.github.com> | 2020-12-04 08:50:24 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-04 11:50:24 -0500 |
commit | 0fd892ad288f2e1eaaa4fdf5e1fd6f15dbd45860 (patch) | |
tree | d7d53d94c6c4026ac9b325508ebce4706d412ac4 /src/components/profile/Cover.tsx | |
parent | f620102190629e0b6f180d3ce056d850b1db5aaa (diff) |
[TMA - 398 AND TMA-430] Replace Providers with Redux Store (#125)
* First
* WIP
* Thunk
* Some more comments
* sc
* recent searches and follounfollow
* Edit profile dummy
* Block / unblock and some cleanup
* Replace auth provider
* Sc
* Delete AP after rebase
* Discover users
* Cleanup
* More cleanup
* Replace profile provider
* Fixed build failure
* Fixed a bug reported
* Prevent app crash when backend server is down
Diffstat (limited to 'src/components/profile/Cover.tsx')
-rw-r--r-- | src/components/profile/Cover.tsx | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/components/profile/Cover.tsx b/src/components/profile/Cover.tsx index 36e41776..3c0f7045 100644 --- a/src/components/profile/Cover.tsx +++ b/src/components/profile/Cover.tsx @@ -1,18 +1,23 @@ -import React from 'react'; +import React, {useContext} from 'react'; import {Image, StyleSheet} from 'react-native'; import Animated from 'react-native-reanimated'; import {IMAGE_WIDTH, COVER_HEIGHT, IMAGE_HEIGHT} from '../../constants'; -import {AuthContext, ProfileContext} from '../../routes/'; +import {useSelector, useStore} from 'react-redux'; +import {RootState} from '../../store/rootreducer'; +import {ScreenType} from '../../types'; +import {DUMMY_USERID, NO_USER_DATA} from '../../store/initialStates'; const {interpolate, Extrapolate} = Animated; interface CoverProps { y: Animated.Value<number>; - isProfileView: boolean; + userXId: string; + screenType: ScreenType; } -const Cover: React.FC<CoverProps> = ({y, isProfileView}) => { - const {cover} = isProfileView - ? React.useContext(ProfileContext) - : React.useContext(AuthContext); +const Cover: React.FC<CoverProps> = ({y, userXId, screenType}) => { + const {cover = ''} = userXId + ? useSelector((state: RootState) => state.userX[screenType][userXId]) + : useSelector((state: RootState) => state.user); + const scale: Animated.Node<number> = interpolate(y, { inputRange: [-COVER_HEIGHT, 0], outputRange: [1.5, 1.25], |