Skip to content

Commit debf342

Browse files
authored
WIP: misc fixes (keybase#25012)
* remove extra space below search on ios * fix android background color thrash on modal presentation
1 parent 33ce326 commit debf342

3 files changed

Lines changed: 67 additions & 81 deletions

File tree

‎shared/profile/user/index.tsx‎

Lines changed: 62 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import * as React from 'react'
2-
import ProfileSearch from '../search/bar'
3-
import * as Kb from '../../common-adapters'
41
import * as Constants from '../../constants/tracker2'
2+
import * as Kb from '../../common-adapters'
3+
import * as RPCTypes from '../../constants/types/rpc-gen'
4+
import * as React from 'react'
55
import * as Styles from '../../styles'
6-
import chunk from 'lodash/chunk'
7-
import upperFirst from 'lodash/upperFirst'
8-
import Bio from '../../tracker2/bio/container'
9-
import Assertion from '../../tracker2/assertion/container'
106
import Actions from './actions/container'
7+
import Assertion from '../../tracker2/assertion/container'
8+
import Bio from '../../tracker2/bio/container'
119
import Friend from './friend/container'
1210
import Measure from './measure'
11+
import ProfileSearch from '../search/bar'
1312
import Teams from './teams/container'
13+
import chunk from 'lodash/chunk'
1414
import shallowEqual from 'shallowequal'
15-
import * as RPCTypes from '../../constants/types/rpc-gen'
1615
import type * as Types from '../../constants/types/tracker2'
17-
import {SiteIcon} from '../generic/shared'
18-
import {HeaderLeftArrow} from '../../common-adapters/header-hoc'
1916
import type {RPCError} from '../../util/errors'
17+
import upperFirst from 'lodash/upperFirst'
18+
import {HeaderLeftArrow} from '../../common-adapters/header-hoc'
19+
import {SiteIcon} from '../generic/shared'
2020

2121
export type BackgroundColorType = 'red' | 'green' | 'blue'
2222

@@ -246,72 +246,64 @@ export type BioTeamProofsProps = {
246246
fullName?: string
247247
title: string
248248
}
249-
export class BioTeamProofs extends React.PureComponent<BioTeamProofsProps> {
250-
render() {
251-
const addIdentity = this.props.onAddIdentity ? (
252-
<Kb.ButtonBar style={styles.addIdentityContainer}>
253-
<Kb.Button
249+
const BioTeamProofs = (props: BioTeamProofsProps) => {
250+
const addIdentity = props.onAddIdentity ? (
251+
<Kb.ButtonBar style={styles.addIdentityContainer}>
252+
<Kb.Button
253+
fullWidth={true}
254+
onClick={props.onAddIdentity}
255+
style={styles.addIdentityButton}
256+
mode="Secondary"
257+
label="Add more identities"
258+
/>
259+
</Kb.ButtonBar>
260+
) : null
261+
return Styles.isMobile ? (
262+
<Kb.Box2 direction="vertical" fullWidth={true} style={styles.bioAndProofs}>
263+
{!!props.reason && (
264+
<Kb.Text
265+
type="BodySmallSemibold"
266+
negative={true}
267+
center={true}
268+
style={Styles.collapseStyles([styles.reason, colorTypeToStyle(props.backgroundColorType)])}
269+
>
270+
{props.reason}
271+
</Kb.Text>
272+
)}
273+
<Kb.Box2 direction="vertical" fullWidth={true} style={{position: 'relative'}}>
274+
<Kb.Box2
275+
direction="vertical"
254276
fullWidth={true}
255-
onClick={this.props.onAddIdentity}
256-
style={styles.addIdentityButton}
257-
mode="Secondary"
258-
label="Add more identities"
277+
style={Styles.collapseStyles([styles.backgroundColor, colorTypeToStyle(props.backgroundColorType)])}
259278
/>
260-
</Kb.ButtonBar>
261-
) : null
262-
return Styles.isMobile ? (
263-
<Kb.Box2 direction="vertical" fullWidth={true} style={styles.bioAndProofs}>
264-
{!!this.props.reason && (
265-
<Kb.Text
266-
type="BodySmallSemibold"
267-
negative={true}
268-
center={true}
269-
style={Styles.collapseStyles([styles.reason, colorTypeToStyle(this.props.backgroundColorType)])}
270-
>
271-
{this.props.reason}
279+
</Kb.Box2>
280+
<BioLayout {...props} />
281+
<Kb.Box2 direction="vertical" fullWidth={true} style={styles.proofsArea}>
282+
<Teams username={props.username} />
283+
<Proofs {...props} />
284+
{addIdentity}
285+
</Kb.Box2>
286+
</Kb.Box2>
287+
) : (
288+
<>
289+
<Kb.Box2
290+
direction="vertical"
291+
fullWidth={true}
292+
style={Styles.collapseStyles([styles.backgroundColor, colorTypeToStyle(props.backgroundColorType)])}
293+
/>
294+
<Kb.Box2 key="bioTeam" direction="horizontal" fullWidth={true} style={styles.bioAndProofs}>
295+
<BioLayout {...props} />
296+
<Kb.Box2 direction="vertical" style={styles.proofs}>
297+
<Kb.Text type="BodySmallSemibold" negative={true} center={true} style={styles.reason}>
298+
{props.reason}
272299
</Kb.Text>
273-
)}
274-
<Kb.Box2 direction="vertical" fullWidth={true} style={{position: 'relative'}}>
275-
<Kb.Box2
276-
direction="vertical"
277-
fullWidth={true}
278-
style={Styles.collapseStyles([
279-
styles.backgroundColor,
280-
colorTypeToStyle(this.props.backgroundColorType),
281-
])}
282-
/>
283-
</Kb.Box2>
284-
<BioLayout {...this.props} />
285-
<Kb.Box2 direction="vertical" fullWidth={true} style={styles.proofsArea}>
286-
<Teams username={this.props.username} />
287-
<Proofs {...this.props} />
300+
<Teams username={props.username} />
301+
<Proofs {...props} />
288302
{addIdentity}
289303
</Kb.Box2>
290304
</Kb.Box2>
291-
) : (
292-
<>
293-
<Kb.Box2
294-
direction="vertical"
295-
fullWidth={true}
296-
style={Styles.collapseStyles([
297-
styles.backgroundColor,
298-
colorTypeToStyle(this.props.backgroundColorType),
299-
])}
300-
/>
301-
<Kb.Box2 key="bioTeam" direction="horizontal" fullWidth={true} style={styles.bioAndProofs}>
302-
<BioLayout {...this.props} />
303-
<Kb.Box2 direction="vertical" style={styles.proofs}>
304-
<Kb.Text type="BodySmallSemibold" negative={true} center={true} style={styles.reason}>
305-
{this.props.reason}
306-
</Kb.Text>
307-
<Teams username={this.props.username} />
308-
<Proofs {...this.props} />
309-
{addIdentity}
310-
</Kb.Box2>
311-
</Kb.Box2>
312-
</>
313-
)
314-
}
305+
</>
306+
)
315307
}
316308

317309
type State = {
@@ -477,9 +469,6 @@ class User extends React.Component<Props, State> {
477469
>
478470
<Kb.Box2 direction="vertical" style={styles.innerContainer}>
479471
{!Styles.isMobile && <Measure onMeasured={this._onMeasured} />}
480-
<Kb.SafeAreaViewTop
481-
style={Styles.collapseStyles([colorTypeToStyle(this.props.backgroundColorType), styles.noGrow])}
482-
/>
483472
{!!this.state.width && (
484473
<Kb.SectionList
485474
key={this.props.username + this.state.width /* forc render on user change or width change */}

‎shared/router-v2/router.native.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ const RNApp = React.memo(() => {
369369
key="root"
370370
screenOptions={{
371371
animationEnabled: false,
372+
// in RNN the background theme is used several times in the stack which causes overdraw if we set it in the theme
373+
// if we don't set it in the theme when modals pop the underlying card's background will visibly thrash while a modal slides up
374+
// this lets us override the card's background so we can not overdraw and not thrash
375+
cardStyle: Styles.isAndroid ? {backgroundColor: Styles.globalColors.white} : undefined,
372376
headerLeft: () => <HeaderLeftCancel />,
373377
headerShown: false, // eventually do this after we pull apart modal2 etc
374378
presentation: 'modal',

‎shared/router-v2/shim.native.tsx‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ const shimNewRoute = (Original: any, isModal: boolean, isLoggedOut: boolean) =>
2929
}
3030

3131
// TODO remove and make all root views have a good background
32-
// on android we make the modals have a white background, else its transparent
33-
wrap = <Kb.NativeView style={isModal ? styles.keyboardModal : styles.keyboard}>{wrap}</Kb.NativeView>
32+
wrap = <Kb.NativeView style={styles.keyboard}>{wrap}</Kb.NativeView>
3433
return wrap
3534
})
3635
Container.hoistNonReactStatic(ShimmedNew, Original)
@@ -46,11 +45,5 @@ const styles = Styles.styleSheetCreate(
4645
maxHeight: '100%',
4746
position: 'relative',
4847
},
49-
keyboardModal: {
50-
backgroundColor: Styles.isAndroid ? Styles.globalColors.white : Styles.globalColors.fastBlank,
51-
flexGrow: 1,
52-
maxHeight: '100%',
53-
position: 'relative',
54-
},
5548
} as const)
5649
)

0 commit comments

Comments
 (0)