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

Cannot override list margins (ul, ol li) #68

Closed
sampsasaarela opened this issue Dec 13, 2017 · 8 comments
Closed

Cannot override list margins (ul, ol li) #68

sampsasaarela opened this issue Dec 13, 2017 · 8 comments

Comments

@sampsasaarela
Copy link

It seems that there is no way to override list margins.

Padding left is hard coded for ul and ol tags here: https://github.com/archriss/react-native-render-html/blob/master/src/HTMLRenderers.js#L100

And margin bottom is hard coded for li tags here: https://github.com/archriss/react-native-render-html/blob/master/src/HTMLRenderers.js#L93

Am I correct? Is there any workaround for this? I think it should be possible to override those values somehow.

@Exilz
Copy link
Contributor

Exilz commented Dec 15, 2017

Hi, you're correct, there is no simple way to change these styles for now.

Maybe we could add a style prop that would be merged with all the default styles for the renderers supplied with the plugin. I don't want to create too much additional props to tweak styling here and there. I feel like there's too much props already.

In the meantime, you can just copy/paste the renderer and change these values however you see fit and add your custom renderer to your renderers prop.

@Exilz
Copy link
Contributor

Exilz commented Jan 2, 2018

This should be fixed in 3.6.0.

@Exilz Exilz closed this as completed Jan 2, 2018
@AlexCatch
Copy link

This doesn't seem to be fixed, passing a style with margin inside seems to have no effect.

@donni106
Copy link

donni106 commented Aug 9, 2018

The marginBottom: 10 for list items is in line 101 now: https://github.com/archriss/react-native-render-html/blob/master/src/HTMLRenderers.js#L101

Will there be a prop in some future version, or do we need to create a custom renderer to change the margin?

@pataar
Copy link

pataar commented Jan 19, 2020

Any solution for this?

@mitchdowney
Copy link

mitchdowney commented Apr 8, 2020

@pataar maybe I'll regret this, but a hacky workaround that seems to work for me is to set marginLeft: -16 on the ul custom tag style.

ul: {
  listStyleType: 'none',
  marginBottom: 0,
  marginLeft: -16,
  marginRight: 0,
  marginTop: 0,
  paddingLeft: 0
},
li: {
  listStyleType: 'none'
}

@systemride
Copy link

This should still be open, there's still no way to override the li element styles.

@jsamr
Copy link
Collaborator

jsamr commented Jan 27, 2021

@systemride You should be able to set margins for lists in the foundry pre-release, see #430 for instructions on how to try it out.

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

No branches or pull requests

8 participants