Skip to content

Update react-theme-provider to v2#3614

Closed
hawkrives wants to merge 12 commits into
masterfrom
update-theming
Closed

Update react-theme-provider to v2#3614
hawkrives wants to merge 12 commits into
masterfrom
update-theming

Conversation

@hawkrives

Copy link
Copy Markdown
Member

Closes #3549


Converts us from ThemeProvider and the withTheme higher-order component (HOC) to ThemeProvider and typed(!) useTheme hook.

Old

type HocProps = {
	theme: AppTheme,
}

type BaseProps = {
	size: number,
}

type Props = BaseProps & HocProps

function Box({theme, size}: Props) {
 	return <View style={{width: size, height: size, backgroundColor: theme.accent}} />
}

const ThemedDottedBar: React.StatelessFunctionalComponent<BaseProps> = (withTheme(
	DottedBar,
): any)

New

type Props = {
	size: number,
}

function Box({size}: Props) {
	let theme = useTheme()
	return <View style={{width: size, height: size, backgroundColor: theme.accent}} />
}

and useTheme automatically(*) knows the shape of our theme.

*: it's defined in @frogpond/theme


NOTE: I don't think I've tried running this locally, but it was blocked on react-theme-provider@2.0.1, which just came out, so I wanted to get this out.

This also has an alternate version of useViewport from #3613; I will resolve the conflict with whichever one goes in first. They're roughly equivalent.

renovate-bot and others added 12 commits March 14, 2019 17:24
…rovider-2.x' into theme-update

* origin/renovate/callstack-react-theme-provider-2.x:
  Update dependency @callstack/react-theme-provider to v2
* master: (98 commits)
  Update dependency react-native-device-info to v1.4.1
  Update dependency react-native-device-info to v1.3.0
  Update dependency react-native-device-info to v1.2.0
  (Maybe) fix sentry sourcemaps
  Update dependency gradle to v5.3.1
  Update dependency danger to v7.0.17
  Update dependency detox to v12
  Update dependency semver to v6
  navigation-buttons: Migrate to platformPrefixIconName
  Update dependency react-native-paper to v2.15.0
  Update dependency react-native to v0.59.2
  remove *:release package.json scripts
  dedupe yarn.lock
  Update yarn.lock
  update circle's Xcode to 10.2
  open skate and open hockey hours
  Rename a few gym hours to insert ice arena hours
  Update dependency danger to v7.0.16
  Update dependency react-native-vector-icons to v6.4.2
  Update dependency react-native-device-info to v1.1.0
  ...

# Conflicts:
#	modules/toolbar/toolbar-button.js
#	source/views/streaming/radio/buttons.js
@hawkrives hawkrives deleted the update-theming branch April 6, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants