question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flow: View can be a string?

See original GitHub issue

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  1. react-native -v:
react-native-cli: 2.0.1
react-native: 0.48.2
  1. node -v:
v8.4.0
  1. npm -v:
5.4.1
  1. flow version:
Flow, a static type checker for JavaScript, version 0.51.1

Then, specify:

  • Target Platform: N/A, Flow static typesystem

  • Development Operating System: macOS

  • Build tools: N/A, Flow static typesystem

Steps to Reproduce

render() {
  return <View ref={(view: ?View) => {}} />;
}
  1. Flow errors out because it thinks View is a string.

Expected Behavior

View should be a React.Component.

Actual Behavior

  1. View is the result of calling requireNativeComponent()
  2. requireNativeComponent returns React$ComponentType<any> | string
  3. Consequently, Flow thinks View can be a string

Reproducible Demo

// @flow

import React from 'react';
import { View } from 'react-native';

class Test extends React.PureComponent {

  render() {
    return <View ref={(view: ?View) => {}} />;
  }

}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
bvaughncommented, Sep 15, 2017

FYI this issue should be fixed by 11b4084. Someone (who has permissions to do so) can probably close this issue.

1reaction
bvaughncommented, Sep 15, 2017

Unfortunately I can’t assign this issue to myself for some reason, but I’ll create a PR shortly that will hopefully provide a meaningful default Flow type for host components. Will post back here once it’s done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pull data from a table as a string
Proud to be a Flownaut! I'm getting data with dataverse. They should both be strings because I'm able to print an email later...
Read more >
Power Automate String Functions + 10 Examples
Here we will see how to use string function concat in the Microsoft Flow or Power Automate. In Power Automate, select manually trigger...
Read more >
Flow Designer If statement not evaluating Strings properly
Just a thought. Can you have flow variable called "email_subject". Read the Email subject in to the flow var and then see if...
Read more >
How can I read data defined as string in Visual Flow Creator?
I have so many datas defined as String and I can see them on Fleet Manager but when I try to get these...
Read more >
From Munawir: Access Dozens of String functions with String ...
String Wizard is an Invocable Action that can be used in Flow. It provides no-code access to all of the string functions that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found