GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix regression in StyleSheet.setStyleAttributePreprocessor by brentvatne · Pull Request #22262 · react/react-native

Conversation

@brentvatne

@brentvatne brentvatne commented Nov 13, 2018

Copy link
Copy Markdown
Collaborator

This regression was caused by 199c918 - property values are initialized to true rather than a string that matches the property name now.

Test Plan:

  • Expo depends on StyleSheet.setStyleAttributePreprocessor in order to map fontFamily names to internal unique ids that represent the font families in our asset system: https://github.com/expo/expo/blob/0c238c1b66e649ed8c90993164e850459f310b95/packages/expo/src/launch/registerRootComponent.tsx#L24
  • It's easy to test this with an identity function: StyleSheet.setStyleAttributePreprocessor('fontFamily', name => name); - this will result in the following error:
fontFamily is not a valid style attribute
- node_modules/react-native/Libraries/StyleSheet/StyleSheet.js:347:23 in setStyleAttributePreprocessor

With this patch, this error is resolved.

Changelog:

  • [General] [Fixed] - Update StyleSheet.setStyleAttributePreprocessor for new format of ReactNativeStyleAttributes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@brentvatne
Fix regression in StyleSheet.setStyleAttributePreprocessor caused by 1…
ad8e3b3
…99c918

Property values are initialized to true rather than a string that matches the
property name now.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 13, 2018
@brentvatne
Remove typeof in comparison
61a5b03
@react-native-bot react-native-bot added Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. 🔶APIs API: StyleSheet labels Nov 13, 2018
janicduplessis
janicduplessis approved these changes Nov 13, 2018
View reviewed changes
@janicduplessis

janicduplessis commented Nov 13, 2018

Copy link
Copy Markdown
Contributor

👍

@facebook-github-bot shipit

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Nov 13, 2018
facebook-github-bot
facebook-github-bot approved these changes Nov 13, 2018
View reviewed changes

@facebook-github-bot facebook-github-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janicduplessis is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@elicwhite

elicwhite commented Nov 13, 2018

Copy link
Copy Markdown
Contributor

Yikes. setStyleAttributePreprocessor is sketchy. Thanks for catching this. Should definitely be handing it being true. The attributes it is checking is what React uses to know how to process host element's props and thus we want those objects to be as small as possible which is why they use true.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@facebook-github-bot facebook-github-bot closed this in 0408533 Nov 14, 2018
@react-native-bot

react-native-bot commented Nov 14, 2018

Copy link
Copy Markdown
Collaborator

@brentvatne merged commit 0408533 into facebook:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@react react locked as resolved and limited conversation to collaborators Nov 14, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Nov 14, 2018
@brentvatne

brentvatne commented Nov 14, 2018

Copy link
Copy Markdown
Collaborator Author

Yikes. setStyleAttributePreprocessor is sketchy

it is a bit, but we do this kind of processing internally so I think there needs to be some way to expose the same power to users. I actually originally added this code iirc but definitely open to ideas for other ways to solve the use case mentioned in op

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kelset pushed a commit that referenced this pull request Nov 26, 2018
@brentvatne @kelset
Fix regression in StyleSheet.setStyleAttributePreprocessor (#22262)
5ba44f7
Summary:
This regression was caused by 199c918 - property values are initialized to true rather than a string that matches the property name now.
Pull Request resolved: #22262

Differential Revision: D13048839

Pulled By: hramos

fbshipit-source-id: 09471334c37f3930aae7e35066943f33f8e617e5
@zpao
zpao deleted the setStyleAttributePreprocessor-fix branch January 31, 2019 01:55
@hramos hramos removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2019
t-nanava pushed a commit to microsoft/react-native-macos that referenced this pull request Jun 17, 2019
@brentvatne @facebook-github-bot
Fix regression in StyleSheet.setStyleAttributePreprocessor (react#22262)
576e65a
Summary:
This regression was caused by 199c918 - property values are initialized to true rather than a string that matches the property name now.
Pull Request resolved: react#22262

Differential Revision: D13048839

Pulled By: hramos

fbshipit-source-id: 09471334c37f3930aae7e35066943f33f8e617e5
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@janicduplessis janicduplessis janicduplessis approved these changes
@facebook-github-bot facebook-github-bot facebook-github-bot approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

API: StyleSheet CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Merged This PR has been merged.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@brentvatne @janicduplessis @elicwhite @react-native-bot @facebook-github-bot @hramos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.