Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android module - Fragment added but not appear #26963

Closed
rener172846 opened this issue Oct 23, 2019 · 2 comments
Closed

Android module - Fragment added but not appear #26963

rener172846 opened this issue Oct 23, 2019 · 2 comments
Labels
Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. Resolution: Locked This issue was locked by the bot.

Comments

@rener172846
Copy link

I have a specific Android native map library and going to integrate that in a React Native project. The library provides the Fragment with the all it features. I tried to make framelayout and add that libraries fragment in it. It seems all functions are applied without any exceptions but the map view isn't appear with size 0.

Following is the replacement codes:

public class MapView extends FrameLayout {
    private MapFragment m_mapFragment;
    private AppCompatActivity m_activity;
    ...

    public MapView(AppCompatActivity context) {
        super(context);

        m_activity = context;
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT
        );
        this.setLayoutParams(params);
    }

    public void init() {
        FragmentManager fragmentManager = m_activity.getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

        m_mapFragment = new MapFragment();
        fragmentTransaction.add(this.getId(), m_mapFragment);

        fragmentTransaction.commitNow();

        View view = m_mapFragment.getView();
        if (view != null) {
            LayoutParams parmas = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            view.setLayoutParams(parmas);
            view.setBackgroundColor(Color.GREEN);
        }
    }
    ...
}

As I debugged when init function is called, the MapView(FrameLayout) has 1080 width as well but mapFragment isn't still shown either map nor green color.

@react-native-bot react-native-bot added the Platform: Android Android applications. label Oct 23, 2019
@react-native-bot
Copy link
Collaborator

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: Needs More Information labels Oct 23, 2019
@hramos hramos added Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. and removed Needs: Author Feedback Bug Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. labels Jan 30, 2020
@hramos hramos closed this as completed Jan 30, 2020
@Shilpi75
Copy link

Can you please help with the resolution? Facing the same issue

@facebook facebook locked as resolved and limited conversation to collaborators Oct 2, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants